Re: XmlSerializer

Stefan Haustein <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
>>when the XmlSerializer is writing to a reader with unspecifyed encoding,
>>I think we should require escaping all character codes > 127? Is that OK?
>>
> 
> you mean to escape using XML entity character references (&#1212; ) right?

yes.

> i do not know - shouldn't it be left to implementation? default XML encoding is
> typically UTF8 and it can transfer any unicode character without need to
> do XML entity escaping.

yes, but if a reader is given and no encoding, we cannot expect utf8,
I think we should really follow a "safe" path here...

> actually another hint to serializer is
>     startDocument (String encoding, Boolean standalone) throws IOException;
> where user can declare even for Writer what is intended XML encoding.
> 
> so i think that requiring it is not needed we should instead require
> that every implementation takes into account encodings
> passed in setOutput() and startDocument().
> should we require both encodings to be identical?

yes we should require that they match.

I still think when no encoding is given, we should assume
no more than 7bit ASCII: When writing using a platform
default writer, the encoding will probably be ISO-Western,
but by using just 7 bit we can make sure
that a parser does not run into trouble when infering utf8 from
the lack of the encoding declaration.

Best,
Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.