From 20c6d0ab19772c51bffcf60a0017d0da508d4293 Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Sun, 13 Apr 2014 23:17:32 +0800 Subject: [PATCH] Fixed an encoding problem --- ChangeLog | 1 + src/xmlassociatexsd.cpp | 6 +++--- src/xmlassociatexsd.h | 2 +- src/xmlcopyeditor.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e32ebf5..094a0b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 1.2.1.1 + x64 installation package * Fixed tab order + * Fixed encoding problems * Fixed invisible captions in high contrast mode (Windows only, http://trac.wxwidgets.org/ticket/16186) 1.2.1 2014/04/06 diff --git a/src/xmlassociatexsd.cpp b/src/xmlassociatexsd.cpp index d09efc9..77d19b4 100644 --- a/src/xmlassociatexsd.cpp +++ b/src/xmlassociatexsd.cpp @@ -28,14 +28,14 @@ #include "replace.h" XmlAssociateXsd::XmlAssociateXsd ( - const std::string& path, + const wxString &path, const char *encoding, size_t size ) : WrapExpat ( encoding ) , d ( new AssociateXsdData() ) { d->buffer.reserve ( size ); - d->path = path; + d->path = path.utf8_str(); // TODO: Using the specified "encoding"; d->rootElementSeen = false; XML_SetElementHandler ( p, start, end ); XML_SetDefaultHandlerExpand ( p, defaulthandler ); @@ -43,7 +43,7 @@ XmlAssociateXsd::XmlAssociateXsd ( std::auto_ptr parser ( new XmlParseSchemaNs() ); std::string normalisedPath, buffer; - normalisedPath = path; + normalisedPath = path.mb_str ( wxConvLocal ); Replace::run ( normalisedPath, "%20", " ", true ); if ( !ReadFile::run ( normalisedPath, buffer ) ) return; diff --git a/src/xmlassociatexsd.h b/src/xmlassociatexsd.h index 086fc13..6b07fff 100644 --- a/src/xmlassociatexsd.h +++ b/src/xmlassociatexsd.h @@ -39,7 +39,7 @@ class XmlAssociateXsd : public WrapExpat { public: XmlAssociateXsd ( - const std::string& path = "", + const wxString &path = wxEmptyString, const char *encoding = NULL, size_t size = BUFSIZ ); virtual ~XmlAssociateXsd(); diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index 1b2fa52..7a84f35 100644 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -5830,7 +5830,7 @@ void MyFrame::OnAssociate ( wxCommandEvent& event ) if ( id == ID_ASSOCIATE_W3C_SCHEMA ) { - XmlAssociateXsd parser ( utf8Path, "UTF-8" ); + XmlAssociateXsd parser ( path, "UTF-8" ); if ( !parser.parse ( utf8Buffer ) ) return; modifiedBuffer = parser.getBuffer();