Fixed an encoding problem

This commit is contained in:
Zane U. Ji 2014-04-13 23:17:32 +08:00
parent 8216a56d1e
commit 20c6d0ab19
4 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
1.2.1.1 1.2.1.1
+ x64 installation package + x64 installation package
* Fixed tab order * Fixed tab order
* Fixed encoding problems
* Fixed invisible captions in high contrast mode (Windows only, http://trac.wxwidgets.org/ticket/16186) * Fixed invisible captions in high contrast mode (Windows only, http://trac.wxwidgets.org/ticket/16186)
1.2.1 2014/04/06 1.2.1 2014/04/06

View File

@ -28,14 +28,14 @@
#include "replace.h" #include "replace.h"
XmlAssociateXsd::XmlAssociateXsd ( XmlAssociateXsd::XmlAssociateXsd (
const std::string& path, const wxString &path,
const char *encoding, const char *encoding,
size_t size ) size_t size )
: WrapExpat ( encoding ) : WrapExpat ( encoding )
, d ( new AssociateXsdData() ) , d ( new AssociateXsdData() )
{ {
d->buffer.reserve ( size ); d->buffer.reserve ( size );
d->path = path; d->path = path.utf8_str(); // TODO: Using the specified "encoding";
d->rootElementSeen = false; d->rootElementSeen = false;
XML_SetElementHandler ( p, start, end ); XML_SetElementHandler ( p, start, end );
XML_SetDefaultHandlerExpand ( p, defaulthandler ); XML_SetDefaultHandlerExpand ( p, defaulthandler );
@ -43,7 +43,7 @@ XmlAssociateXsd::XmlAssociateXsd (
std::auto_ptr<XmlParseSchemaNs> parser ( new XmlParseSchemaNs() ); std::auto_ptr<XmlParseSchemaNs> parser ( new XmlParseSchemaNs() );
std::string normalisedPath, buffer; std::string normalisedPath, buffer;
normalisedPath = path; normalisedPath = path.mb_str ( wxConvLocal );
Replace::run ( normalisedPath, "%20", " ", true ); Replace::run ( normalisedPath, "%20", " ", true );
if ( !ReadFile::run ( normalisedPath, buffer ) ) if ( !ReadFile::run ( normalisedPath, buffer ) )
return; return;

View File

@ -39,7 +39,7 @@ class XmlAssociateXsd : public WrapExpat
{ {
public: public:
XmlAssociateXsd ( XmlAssociateXsd (
const std::string& path = "", const wxString &path = wxEmptyString,
const char *encoding = NULL, const char *encoding = NULL,
size_t size = BUFSIZ ); size_t size = BUFSIZ );
virtual ~XmlAssociateXsd(); virtual ~XmlAssociateXsd();

View File

@ -5830,7 +5830,7 @@ void MyFrame::OnAssociate ( wxCommandEvent& event )
if ( id == ID_ASSOCIATE_W3C_SCHEMA ) if ( id == ID_ASSOCIATE_W3C_SCHEMA )
{ {
XmlAssociateXsd parser ( utf8Path, "UTF-8" ); XmlAssociateXsd parser ( path, "UTF-8" );
if ( !parser.parse ( utf8Buffer ) ) if ( !parser.parse ( utf8Buffer ) )
return; return;
modifiedBuffer = parser.getBuffer(); modifiedBuffer = parser.getBuffer();