backported wxFileConfig fix for Unicode mode: always use utf-8
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20066 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -174,7 +174,8 @@ public:
|
||||
const char* cWX2MB(const char *psz) const { return psz; }
|
||||
};
|
||||
|
||||
WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc, wxConvFile, wxConvLocal, wxConvISO8859_1;
|
||||
WXDLLEXPORT_DATA(extern wxMBConv) wxConvLibc, wxConvFile, wxConvLocal,
|
||||
wxConvISO8859_1, wxConvUTF8;
|
||||
WXDLLEXPORT_DATA(extern wxMBConv *) wxConvCurrent;
|
||||
|
||||
#define wxFNCONV(name) name
|
||||
|
@@ -384,11 +384,7 @@ void wxFileConfig::Init()
|
||||
{
|
||||
wxTextFile fileGlobal(m_strGlobalFile);
|
||||
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if ( fileGlobal.Open( wxConvUTF8 ) )
|
||||
#else
|
||||
if ( fileGlobal.Open() )
|
||||
#endif
|
||||
if ( fileGlobal.Open(wxConvUTF8/*ignored in ANSI build*/) )
|
||||
{
|
||||
Parse(fileGlobal, FALSE /* global */);
|
||||
SetRootPath();
|
||||
@@ -403,11 +399,7 @@ void wxFileConfig::Init()
|
||||
if ( !m_strLocalFile.IsEmpty() && wxFile::Exists(m_strLocalFile) )
|
||||
{
|
||||
wxTextFile fileLocal(m_strLocalFile);
|
||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
||||
if ( fileLocal.Open( wxConvUTF8 ) )
|
||||
#else
|
||||
if ( fileLocal.Open() )
|
||||
#endif
|
||||
if ( fileLocal.Open(wxConvUTF8/*ignored in ANSI build*/) )
|
||||
{
|
||||
Parse(fileLocal, TRUE /* local */);
|
||||
SetRootPath();
|
||||
@@ -965,12 +957,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
||||
{
|
||||
wxString line = p->Text();
|
||||
line += wxTextFile::GetEOL();
|
||||
#if wxUSE_UNICODE
|
||||
wxCharBuffer buf = wxConvLocal.cWX2MB( line );
|
||||
if ( !file.Write( (const char*)buf, strlen( (const char*) buf ) ) )
|
||||
#else
|
||||
if ( !file.Write( line.c_str(), line.Len() ) )
|
||||
#endif
|
||||
if ( !file.Write(line, wxConvUTF8) )
|
||||
{
|
||||
wxLogError(_("can't write user configuration file."));
|
||||
return FALSE;
|
||||
|
@@ -58,7 +58,8 @@
|
||||
WXDLLEXPORT_DATA(wxMBConv) wxConvLibc,
|
||||
wxConvFile,
|
||||
wxConvISO8859_1,
|
||||
wxConvLocal;
|
||||
wxConvLocal,
|
||||
wxConvUTF8;
|
||||
#endif // wxUSE_WCHAR_T
|
||||
|
||||
WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
|
||||
|
Reference in New Issue
Block a user