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; }
|
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;
|
WXDLLEXPORT_DATA(extern wxMBConv *) wxConvCurrent;
|
||||||
|
|
||||||
#define wxFNCONV(name) name
|
#define wxFNCONV(name) name
|
||||||
|
@@ -384,11 +384,7 @@ void wxFileConfig::Init()
|
|||||||
{
|
{
|
||||||
wxTextFile fileGlobal(m_strGlobalFile);
|
wxTextFile fileGlobal(m_strGlobalFile);
|
||||||
|
|
||||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
if ( fileGlobal.Open(wxConvUTF8/*ignored in ANSI build*/) )
|
||||||
if ( fileGlobal.Open( wxConvUTF8 ) )
|
|
||||||
#else
|
|
||||||
if ( fileGlobal.Open() )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Parse(fileGlobal, FALSE /* global */);
|
Parse(fileGlobal, FALSE /* global */);
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
@@ -403,11 +399,7 @@ void wxFileConfig::Init()
|
|||||||
if ( !m_strLocalFile.IsEmpty() && wxFile::Exists(m_strLocalFile) )
|
if ( !m_strLocalFile.IsEmpty() && wxFile::Exists(m_strLocalFile) )
|
||||||
{
|
{
|
||||||
wxTextFile fileLocal(m_strLocalFile);
|
wxTextFile fileLocal(m_strLocalFile);
|
||||||
#if defined(__WXGTK20__) && wxUSE_UNICODE
|
if ( fileLocal.Open(wxConvUTF8/*ignored in ANSI build*/) )
|
||||||
if ( fileLocal.Open( wxConvUTF8 ) )
|
|
||||||
#else
|
|
||||||
if ( fileLocal.Open() )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
Parse(fileLocal, TRUE /* local */);
|
Parse(fileLocal, TRUE /* local */);
|
||||||
SetRootPath();
|
SetRootPath();
|
||||||
@@ -965,12 +957,7 @@ bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
|||||||
{
|
{
|
||||||
wxString line = p->Text();
|
wxString line = p->Text();
|
||||||
line += wxTextFile::GetEOL();
|
line += wxTextFile::GetEOL();
|
||||||
#if wxUSE_UNICODE
|
if ( !file.Write(line, wxConvUTF8) )
|
||||||
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
|
|
||||||
{
|
{
|
||||||
wxLogError(_("can't write user configuration file."));
|
wxLogError(_("can't write user configuration file."));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@@ -58,7 +58,8 @@
|
|||||||
WXDLLEXPORT_DATA(wxMBConv) wxConvLibc,
|
WXDLLEXPORT_DATA(wxMBConv) wxConvLibc,
|
||||||
wxConvFile,
|
wxConvFile,
|
||||||
wxConvISO8859_1,
|
wxConvISO8859_1,
|
||||||
wxConvLocal;
|
wxConvLocal,
|
||||||
|
wxConvUTF8;
|
||||||
#endif // wxUSE_WCHAR_T
|
#endif // wxUSE_WCHAR_T
|
||||||
|
|
||||||
WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
|
WXDLLEXPORT_DATA(wxMBConv *) wxConvCurrent = &wxConvLibc;
|
||||||
|
Reference in New Issue
Block a user