On 9/22/06 10:22 AM, "Yonik Seeley" <[EMAIL PROTECTED]> wrote:

> What I think might be ideal: If there is a charset definition, then
> let the servlet handle it by requesting a Writer.  If there isn't
> a charset definition, request a byte-oriented InputStream from the
> container and let the XML parser try and figure out the encoding.

RFC 3023 is precise about this, so there is no need to guess.
The only question is how to implement the required behavior.
Here is a summary.

If there is a charset spec, use it and ignore any encoding
spec in the content.

If there is no charset spec for text/xml, use ASCII.

If there is no charset spec for application/xml, follow the
XML spec to determine encoding.

The safest way to send XML over HTTP is:

* use a standard XML encoding: UTF-8 or UTF-16 with BOM
* include an encoding in the <?xml?> line in the document
* use a content-type of application/xml without a charset param

Details are at http://www.ietf.org/rfc/rfc3023.txt

wunder
--
Walter Underwood
Search Guru, Neflix

Reply via email to