[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 17:16:37
Message-ID: 441062F5.40509 () apache ! org
[Download RAW message or body]

Steven T. Hatton wrote:
> On Thursday 09 March 2006 02:08, David Bertoni wrote:
> 
>> What does this simply program output on your system and compiler?
> 
> wchar_t is 32 bits on my system.  I believe that a 16 bit storage unit will 
> under normal circumstances occupy a 32 bit memory location, but only use half 
> of it.
> 

Yes, and don't you think that's rather wasteful?  Would you use Xerces-C 
to process large XML documents if you knew it was wasting half of its 
character string storage just so it could use wchar_t on all platforms?

>> 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.
> 
> Why does Xerces-C use a non-standard data type?

unsigned short is not a non-standard type.  You may think it's 
"non-standard" for holding character data, but Xerces-C encodes 
character data in UTF-16 code units, and that requires a 16-bit integral 
type.

> If my implementation doesn't support a particular locale, and
 > therefore does not use a 16 bit or larger data type, then what are the
 > chances that I would use Xerces-C to support such a character set?

You've got it backwards -- Xerces-C only support the current locale's 
character set in a very limited fashion, by providing a way to transcode 
UTF-16 strings to character strings in the current locale.  Otherwise, 
it operates internally exclusively in UTF-16, and it is unaffected by 
the current locale or how the system encodes char or wchar_t.

Dave

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


---------------------------------------------------------------------
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