Re: [xml] Using wchar_t string with libxml2.



On Wed, Jan 26, 2005 at 12:26:09PM +0000, Arthur_Yarwood scee net wrote:
  You must convert your wide strings into UTF-8 strings before passing 
them
to the libxml2 API. I think 
    http://xmlsoft.org/encoding.html#internal
is clear about that. If not I take patches to make this clearer.


Ok, does that mean there could possibly be a loss of data, for characters 
that need two bytes? Or have I got the wrong end of the stick when it 
comes to storing Unicode strings?

I've just tried using 'wcstombs()' to convert my wide string to a 
multi-byte string, which I can then BAD_CAST to xmlChar. Is this the 
correct way of doing this? I just tried passing a random arabic string 
through wcstombs() and it fails, because it cannot a wide character. 

  You need to find the way to convert your input. UTF-8 can handlle the
full Unicode range.

How should I convert my random arabic string to utf-8? Is it possible? 

  Any Unicode code point has a representation in UTF-8, the answer should
be yes.

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
postmaster scee net

  This is not compatible with the mailing-list policy. Please get rid of
this footer because we will make any communication made to this list publicly
available and searchable even by non-subscribers to the list. Tell your
management and IT hierarchy that this is incompatible with working with
Open Source projects ! You may get private support for libxml2 code but
I exect this to be only made as part of commercial support contacts (with
whoever may want to sell such support).

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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