summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-07-10 16:14:08 +0200
committerDavid Tardon <dtardon@redhat.com>2014-07-10 16:35:45 +0200
commit5eb408a3bb8df204452f0b931a254dad5f0cf35b (patch)
tree8ff0bd2e865f15f0fe14a9e7c3bd103428e368a4 /svtools/source
parent6476f559070f0a7f2bb14f5f9a29d5bb10e62bb5 (diff)
fdo#81044 detect UTF-8 BOM too
Change-Id: I6fd041780b889e2125b916964ba27d032667dcd6
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/svrtf/svparser.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 51783a654f26..da904a3009e5 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -185,6 +185,25 @@ sal_Unicode SvParser::GetNextChar()
}
}
}
+ else if( 0xef == c1 || 0xbb == c1 ) // check for UTF-8 BOM
+ {
+ rInput.ReadUChar( c2 );
+ bErr = rInput.IsEof() || rInput.GetError();
+ if( !bErr )
+ {
+ if( ( 0xef == c1 && 0xbb == c2 ) || ( 0xbb == c1 && 0xef == c2 ) )
+ {
+ unsigned char c3(0);
+ rInput.ReadUChar( c3 );
+ bErr = rInput.IsEof() || rInput.GetError();
+ if( !bErr && ( 0xbf == c3 ) )
+ {
+ eSrcEnc = RTL_TEXTENCODING_UTF8;
+ bSeekBack = false;
+ }
+ }
+ }
+ }
}
if( bSeekBack )
rInput.Seek( 0 );