Don't assume the encoding of a large file is UTF-8
This commit is contained in:
parent
3ad1790076
commit
54e2064fe9
|
@ -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 &&
|
||||||
|
|
Loading…
Reference in New Issue