[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-c-dev
Subject:    Re: How do I use Xerces strings?
From:       David Bertoni <dbertoni () apache ! org>
Date:       2006-03-09 7:08:13
Message-ID: 440FD45D.6060501 () apache ! org
[Download RAW message or body]

Steven T. Hatton wrote:
> On Wednesday 08 March 2006 03:30, Lumir Vanek wrote:
>> Hi,
>>
>> in KXMLEditor we have helper class for QString - XMLCh* conversion, look
>> at:
>>
>> http://cvs.sourceforge.net/viewcvs.py/kxmleditor/kxmleditor/part/kxestring.
>> h?rev=1.7&view=markup
>>
>> A am not sure, if this approach is absolutely right, but it works for me.
> 
> It looks as though the ucs2() has been depracated in favor of utf16 in Qt4.  
> What I've been trying to figure out is what it means that Xerces C++ and 
> Linux wchar_t don't get along well.

What does this simply program output on your system and compiler?

#include <stddef.h>
#include <iostream>
#include <xercesc/util/XMLUniDefs.hpp>

int
main()
{
     if (sizeof(XMLCh) == sizeof(wchar_t))
     {
         std::cout << "Congratulations, wchar_t is a 16-bit integral.\n";
     }
     else
     {
         std::cout << "Sorry, wchar_t is not a 16-bit integral.\n";
     }

     return 0;
}

On my Fedora Core 4 system, with GCC 4.0.0, I get:

     Sorry, wchar_t is not a 16-bit integral.

I'm not sure anyone has ever said that Xerces-C and Linux wchar_t "don't 
get along."  The problem is that Xerces-C encodes string data in UTF-16 
internally, and using wchar_t to hold UTF-16 code points is not portable.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic