Don't assume the encoding of a large file is UTF-8

This commit is contained in:
Zane U. Ji 2014-04-23 20:48:37 +08:00
parent 3ad1790076
commit 54e2064fe9
1 changed files with 1 additions and 5 deletions

View File

@ -3079,11 +3079,7 @@ bool MyFrame::openFile ( wxString& fileName, bool largeFile )
size_t finalBufferLen; size_t finalBufferLen;
std::string encoding; std::string encoding;
if ( largeFile ) if ( docBufferLen >= 4 && // UTF-32 BE
{
encoding = "UTF-8";
}
else if ( docBufferLen >= 4 && // UTF-32 BE
( unsigned char ) docBuffer[0] == 0x00 && ( unsigned char ) docBuffer[0] == 0x00 &&
( unsigned char ) docBuffer[1] == 0x00 && ( unsigned char ) docBuffer[1] == 0x00 &&
( unsigned char ) docBuffer[2] == 0xFE && ( unsigned char ) docBuffer[2] == 0xFE &&