so what is the point of the xml spec having the encoding attribute if you have to figure out the encoding before you even get to the specified encoding. I mean, there are hundreds of encodings in use, aren't there? GB-2312(I use this for chinese), Big5, etc. etc. The list goes on an on. I know java supports many of those encodings, but can they all be told apart just by the "<" character, or do some encodings represent that character exactly the same(I would suspect a few might). Who would know why this encoding attribute exists in the header?
thanks,
dean

Jochen Wiedmann wrote:

[EMAIL PROTECTED] wrote:

I am wondering how encoding works in JaxME(and in general)

Say I have a header bytes. Now, I happen to know those bytes are encoded
in utf-16 and so I can parse the header to the following.....

<?xml version="1.0" encoding="utf-16"?>

1. Isn't this a catch 22?  I can only read this into a string if I know
ahead of time that it is utf-16(in which case, specifying encoding
attribute is useless)?


If it is utf-16 indeed, then the "<" is encoded as two bytes, which can be clearly distinguished from the two bytes "<?", which you would see in UTF-8, or ASCII.


2. OR is the header always in ascii and then when I get to the encoding, I
know to read in everything else as utf-16?


No, the header is in the same encoding.


How does encoding work with JaxME?


Just in the same way than for any other XML parser/creator.


Jochen



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

Reply via email to