mirror of https://github.com/odrling/Aegisub
Fix a bug (in a somewhat questionable manner) that would cause the text file writer to occasionally think the system locale was Unicode when it wasn't (by using an uninitialized variable in a condition). Should fix the issue with the SRT export filter failing to write "1" on the first line when using "local" as the text encoding.
Originally committed to SVN as r2904.
This commit is contained in:
parent
1e2a031765
commit
4d83215690
|
@ -54,7 +54,15 @@ TextFileWriter::TextFileWriter(wxString _filename,wxString enc) {
|
|||
|
||||
// Set encoding
|
||||
encoding = enc;
|
||||
if (encoding == _T("Local") || (encoding.IsEmpty() && Options.AsText(_T("Save Charset")).Lower() == _T("local"))) conv = &wxConvLocal;
|
||||
if (encoding == _T("Local") || (encoding.IsEmpty() && Options.AsText(_T("Save Charset")).Lower() == _T("local"))) {
|
||||
conv = &wxConvLocal;
|
||||
wxFontEncoding sysenc = wxLocale::GetSystemEncoding();
|
||||
if (sysenc == wxFONTENCODING_UTF8 || sysenc == wxFONTENCODING_UTF7 ||
|
||||
sysenc == wxFONTENCODING_UNICODE) // that last one may be a bit questionable
|
||||
IsUnicode = true;
|
||||
else
|
||||
IsUnicode = false;
|
||||
}
|
||||
else {
|
||||
if (encoding.IsEmpty()) encoding = Options.AsText(_T("Save Charset"));
|
||||
if (encoding == _T("US-ASCII")) encoding = _T("ISO-8859-1");
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
// Headers
|
||||
#include <wx/wxprec.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/intl.h>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue