Use wxMBConvUTF8 when G_FILENAME_ENCODING is UTF-8, and set
G_FILENAME_ENCODING to match the locale encoding when necessary git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -369,26 +369,28 @@ wxConvBrokenFileNames::wxConvBrokenFileNames()
|
|||||||
|
|
||||||
// (1) this variable exists for the sole purpose of specifying the encoding
|
// (1) this variable exists for the sole purpose of specifying the encoding
|
||||||
// of the filenames for GTK+ programs, so use it if it is set
|
// of the filenames for GTK+ programs, so use it if it is set
|
||||||
const wxChar *encName = wxGetenv(_T("G_FILENAME_ENCODING"));
|
wxString encName(wxGetenv(_T("G_FILENAME_ENCODING")));
|
||||||
if ( encName )
|
encName.MakeUpper();
|
||||||
|
if ( !encName.empty() && encName != _T("UTF-8") && encName != _T("UTF8") )
|
||||||
{
|
{
|
||||||
m_conv = new wxCSConv(encName);
|
m_conv = new wxCSConv(encName);
|
||||||
}
|
}
|
||||||
else // no G_FILENAME_ENCODING
|
else // no G_FILENAME_ENCODING
|
||||||
{
|
{
|
||||||
|
if ( encName.empty() )
|
||||||
|
encName = wxLocale::GetSystemEncodingName().Upper();
|
||||||
|
|
||||||
// (2) if a non default locale is set, assume that the user wants his
|
// (2) if a non default locale is set, assume that the user wants his
|
||||||
// filenames in this locale too
|
// filenames in this locale too
|
||||||
switch ( wxLocale::GetSystemEncoding() )
|
if ( !encName.empty() && encName != _T("UTF-8") && encName != _T("UTF8") )
|
||||||
{
|
{
|
||||||
default:
|
wxSetEnv(_T("G_FILENAME_ENCODING"), encName);
|
||||||
m_conv = new wxMBConvLibc;
|
m_conv = new wxMBConvLibc;
|
||||||
break;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// (3) finally use UTF-8 by default
|
// (3) finally use UTF-8 by default
|
||||||
case wxFONTENCODING_SYSTEM:
|
|
||||||
case wxFONTENCODING_UTF8:
|
|
||||||
m_conv = new wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL);
|
m_conv = new wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_OCTAL);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user