Unless I'm missing something, what you're asking does not sound
possible, unless a) you transcode to an encoding that you know
represents each character in your input in a single byte, or b) you're
willing to discard any characters that cannot be represented in a single
byte.  If you use XMLString::transcode(), you're transcoding to whatever
the system's default encoding is, so there's no way to guarantee that
every character will take up a single byte.

Ideally, you'd store UTF-8 (std::wstring might serve your purposes),
since you've already got it and it can represent any character with
reasonable efficiency.  If that's not an option, I think you'll need to
create your own transcoder.  See the documentation for XMLTransService
(particularly makeNewTranscoderFor()) and XMLTranscoder (particularly
transcodeTo()).

> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Hans Stoessel
> Sent: Wednesday, October 12, 2005 11:16 AM
> To: [email protected]
> Subject: Transcoding on Mac OS X
> 
> Hi
> 
> I parse an UTF-8 xml file on Mac OS X. In my C++ application 
> I use the a 
> standard string (std::string) to save the content of the 
> tags. Now I have 
> problems with characters > 127. If I use XMLString::transcode 
> there are two 
> bytes for such a character instead of one byte. But the 
> std::string uses 
> only char's (1 byte) for storing the data.
> 
> How can I transcode the contents from XMLCh (2 bytes) into 
> the right format 
> for my std::string's?
> 
> Thanks for any help.
> 
> Regards
> Hans 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to