git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44056
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
ctx.encoding = wxT("UTF-8"); // default in absence of encoding=""
ctx.conv = NULL;
#if !wxUSE_UNICODE
ctx.encoding = wxT("UTF-8"); // default in absence of encoding=""
ctx.conv = NULL;
#if !wxUSE_UNICODE
- if ( encoding != wxT("UTF-8") && encoding != wxT("utf-8") )
+ if ( encoding.CmpNoCase(wxT("UTF-8")) != 0 )
ctx.conv = new wxCSConv(encoding);
#endif
ctx.removeWhiteOnlyNodes = (flags & wxXMLDOC_KEEP_WHITESPACE_NODES) == 0;
ctx.conv = new wxCSConv(encoding);
#endif
ctx.removeWhiteOnlyNodes = (flags & wxXMLDOC_KEEP_WHITESPACE_NODES) == 0;
- wxMBConv *convMem = NULL;
+ wxMBConv *convMem = NULL,
+ *convFile;
- wxMBConv *convFile = new wxCSConv(GetFileEncoding());
+ convFile = new wxCSConv(GetFileEncoding());
+ convMem = NULL;
- wxMBConv *convFile = NULL;
- if ( GetFileEncoding() != GetEncoding() )
+ if ( GetFileEncoding().CmpNoCase(GetEncoding()) != 0 )
{
convFile = new wxCSConv(GetFileEncoding());
convMem = new wxCSConv(GetEncoding());
}
{
convFile = new wxCSConv(GetFileEncoding());
convMem = new wxCSConv(GetEncoding());
}
+ else // file and in-memory encodings are the same, no conversion needed
+ {
+ convFile =
+ convMem = NULL;
+ }
#endif
s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
#endif
s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
OutputNode(stream, GetRoot(), 0, convMem, convFile, indentstep);
OutputString(stream, wxT("\n"));
OutputNode(stream, GetRoot(), 0, convMem, convFile, indentstep);
OutputString(stream, wxT("\n"));
- if ( convFile )
- delete convFile;
- if ( convMem )
- delete convMem;
+ delete convFile;
+ delete convMem;