Kaydet (Commit) 5eb408a3 authored tarafından David Tardon's avatar David Tardon

fdo#81044 detect UTF-8 BOM too

Change-Id: I6fd041780b889e2125b916964ba27d032667dcd6
üst 6476f559
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment