Re: [libxml++] Libxml++ and Glib



> On Wed, 29 Sep 2004 09:31:22 +0200
> Frederik Himpe <frederikhimpe arafox com> wrote:
>
>> On Wednesday 29 September 2004 00:59, Dedov Anton wrote:
>> > Hello,
>> >
>> > I am developing C++ XML-RPC library using libxml++
>> > (http://libiqxmlrpc.sourceforge.net). I used libxml++ 1.0 till this
>> > time. Now I need support for non-ASCII characters in my library. If I
>> > understand right libxml++ implements it in 2.x versions by using
>> > glib::ustring.
>>
>> I've been using libxml++ 1.0 some time ago to develop a SAX parser which
>> treated non-ASCI characters (the files were in UTF-8 and contained
>> characters
>> such as __ and __), and this worked fine with std::string. It's just
>> when for
>> example you ask the length of the string, you will get the length in
>> bytes,
>> which will not correspond to the number of letters in the string,
>> because
>> special characters need two bytes in UTF-8.
>
> So I just need convert any text from my locale's charset to utf-8 every
> time I process it to xml (and vice versa)?

Let's be clearer:
1. libxml++ takes UTF8 in its API.
2. libxml++ gives UTF8 in its API.
3. libxml++ can parse documents in any encoding, if the encoding is
properly declared in the document.

libxml++ uses UTF8 in its API because UTF8 is the encoding that can
represent anything.

If you want to convert, or manipulate, UTF8 without Glib::ustring, the I
can recommend the glib g_utf8_* functions that Glib::ustring uses.
However, I think you will be making your life more difficult than if you
just use Glib::ustring.

Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]