Use the same default encoding to read and write file (Bug #234)

This commit is contained in:
Zane U. Ji 2020-07-25 16:33:24 +08:00
parent a03a8941c3
commit 6eb5ade55c
2 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
# Version number followed by the release date
1.2.1.5
* Use the same default encoding to read and write file (Bug #234)
* Only show SSE2 warning in debug build
* Bug #228 Misleading translation when file was changed externally, may lead to data loss
* Bug #227 Dead Link: Help > Forum

View File

@ -3139,7 +3139,11 @@ bool MyFrame::openFile ( const wxString &file, bool largeFile )
es.parse ( docBuffer, docBufferLen );
encoding = es.getEncoding();
if ( encoding.empty() ) // Expat couldn't parse file (e.g. UTF-32)
{
encoding = getApproximateEncoding ( docBuffer, docBufferLen );
if ( encoding.empty() )
encoding = "UTF-8";
}
}
// convert buffer if not UTF-8