Am Donnerstag, 23. Juni 2005 07:18 schrieb Sucheta Phatak:
> Hi ,
>
> I am using Xerces parser for parsing my XML files. I have following
> doubt about the XMLch internal encoding.
>
> What is the internal encoding used for XMLch? From the documentation
> provided I found that its UTF-16.
> But it does not specify which UTF-16
> UTF-16LE or UTF-16BE .
> Or does it depend on the machine I am working on. i.e When I am
> working on machine with Big Endian orientation then XMLch will have
> internal encoding as UTF-16BE and vice versa.
>
> My basic need is to convert XMLch strings that I get during parsing,
> into UTF-8. But for that I need to know the source encoding. Is there
> any other way, to do such conversion?

Hi Sucheta,

your problem is less demanding than you might expect. Indeed, the 
internal representation of XMLCh is UTF-16, and is little endian on 
little endian machines and big endian on big endian machines. From the 
point of view of programming C/C++, this is transparent, e.g the 
expression (1 << 15) always means bit no. 15, regardless it's 
endianness.

Before you write your own transcoder, you might want to have a look at 
the builtin transcoders, which are located in src/util/Transcoders/*. 
Depending on the operating system (and wheather icu-devel is 
installed), you may choose which transcoder you want to use.

For convenience, transcoding of strings from/to the current local 
encoding, you can use XMLString::transcode(.). If you want to ensure to 
transcode from/to UTF-8, you should set the local encoding to UTF-8 at 
the beginning of your program. (Don't forget to release the transcoded 
strings with XMLString::release(.) after use.)

Does this help?
                        Axel

-- 
Humboldt-Universität zu Berlin
Institut für Informatik
Signalverarbeitung und Mustererkennung
Dipl.-Inf. Axel Weiß
Rudower Chaussee 25
12489 Berlin-Adlershof
+49-30-2093-3050
** www.freesp.de **

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

Reply via email to