Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
TinyXml with Unicode thread
takeshimiya:
Well, the problems of TinyXml and Unicode are still there.
I just found a piece of code that could help here:
wxtinyxml.cpp
--- Code: ---// This crude code is for using wxWidget streams with TinyXML.
// This is useful, for example, for loading and saving XML directly
// into a ZIP file (with the new ZIP streams in 2.5.4).
// Copyright (c) 2005 Andrew Ziem. All rights reserved.
// This code is licensed under the three licenses: wxWindows Library Licence, Version 3;
// Zlib license (like TinyXML); and the GNU General Public License version 2 or later.
#include "wxtinyxml.h"
bool wxTiXmlDocument::LoadFile( wxInputStream &istream )
{
Clear();
location.Clear();
wxTextInputStream txt(istream);
wxString data;
do
{
const wxString s = txt.ReadLine();
if ( istream.Eof() && s.empty() )
break;
data += s;
} while (1);
Parse( wxConvCurrent->cWX2MB(data), 0, TIXML_ENCODING_UTF8 );
if ( Error() )
return false;
else
return true;
}
--- End code ---
wxtinyxml.h
--- Code: ---bool wxTiXmlDocument::SaveFile (wxOutputStream &ostream)
{
wxTextOutputStream txt(ostream);
#ifdef TIXML_USE_STL
#error not implemented
#else
TiXmlOutStream outs;
StreamOut (&outs);
const char *c = outs.c_str();
txt << wxString(c, wxConvUTF8);
#endif
}
#ifndef __WXTINYXML_H__
#define __WXTINYXML_H__
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "tinyxml.h"
#include "wx/txtstrm.h"
class wxTiXmlDocument : public TiXmlDocument
{
public:
bool LoadFile( wxInputStream &istream );
bool SaveFile( wxOutputStream &ostream );
};
#endif
--- End code ---
If that doesn't helps, let's try another solution so we can end with this bug.
280Z28:
The problems of TinyXML and Unicode are there. Would you like to try my patch that fixes it all?
takeshimiya:
Of couse, I'll try that. :)
280Z28:
http://sourceforge.net/tracker/index.php?func=detail&aid=1385378&group_id=126998&atid=707418
http://sourceforge.net/tracker/index.php?func=detail&aid=1384347&group_id=126998&atid=707418
http://sourceforge.net/tracker/index.php?func=detail&aid=1382579&group_id=126998&atid=707418
There are a couple more smaller issues I fixed, but posting patches isn't seeming very worthwhile these days. Those 3 go back to 4 days ago. I have 9 other patches on SF right now, those 3 target Unicode specific problems.
280Z28:
Hang on, I'll get you a patch right now that fixes the "Code::Blocks v1.0" shows as "C v1" fix. I didn't and won't post it on SF because I was already told it won't get committed.
Navigation
[0] Message Index
[#] Next page
Go to full version