diff options
author | Jan Holesovsky <kendy@collabora.com> | 2016-11-03 17:14:01 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2016-11-03 21:07:19 +0100 |
commit | b297f7bbfed83f87398231740e910afe6ebfbb97 (patch) | |
tree | a00d6cf4675a5dd01bba21f140197ba130a28114 /svtools | |
parent | 5d9d0f3c979732ade57b9c4c4960dd030ffdc9f9 (diff) |
tdf#88821: Set the encoding correctly for HTML files with a BOM.
BOM (Byte Order Mark) in the HTML file changed the underlying eSrcEnc
encoding, but did not actually update the rtl_TextToUnicodeConverter hConv.
Subsequent changes of eSrcEnc in SetSrcEncoding() (triggered by
'content="application/xhtml+xml; charset=UTF-8"' in the HTML file) were then
ignored (eSrcEnc was already set to UTF-8), and the parser was happily using the
old (Windows-1250) hConv.
Change-Id: If432d59891d51c6abe3517e325ed73057d0f8610
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/source/svrtf/svparser.cxx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index b749400a0e26..ae6c1ebcffe0 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -104,7 +104,6 @@ void SvParser::ClearTxtConvContext() void SvParser::SetSrcEncoding( rtl_TextEncoding eEnc ) { - if( eEnc != eSrcEnc ) { if( pImplData && pImplData->hConv ) @@ -172,13 +171,13 @@ sal_uInt32 SvParser::GetNextChar() { if( 0xfe == c1 && 0xff == c2 ) { - eSrcEnc = RTL_TEXTENCODING_UCS2; + SetSrcEncoding(RTL_TEXTENCODING_UCS2); bUCS2BSrcEnc = true; bSeekBack = false; } else if( 0xff == c1 && 0xfe == c2 ) { - eSrcEnc = RTL_TEXTENCODING_UCS2; + SetSrcEncoding(RTL_TEXTENCODING_UCS2); bUCS2BSrcEnc = false; bSeekBack = false; } @@ -198,7 +197,7 @@ sal_uInt32 SvParser::GetNextChar() bErr = rInput.IsEof() || rInput.GetError(); if( !bErr && ( 0xbf == c3 ) ) { - eSrcEnc = RTL_TEXTENCODING_UTF8; + SetSrcEncoding(RTL_TEXTENCODING_UTF8); bSeekBack = false; } } |