[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: HTTP-Header charset different to charset encoding

Subject: Re: HTTP-Header charset different to charset encoding statement in XML-Declaration
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Sun, 14 Mar 2010 17:07:41 +0000
Re:  HTTP-Header charset different to charset encoding
> only a quick question. I've to handle xml in the body of an HTTP response.
> The problem is that  http header can specify an encoding different from the
processing instruction, like here:
>
> HTTP-Header:
>
> Content-Type: application/xhtml+xml; charset=UTF-8
>
>
>  1: <?xml version="1.0" encoding="ISO-8859-1"?>
>  2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>  3:      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>  4:
>  5: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
>  6:   <head>
>  7:     <title>HTTP != XML</title>
>  8:   </head>
>  9:   <body>dv|DV\_</body>
>  10: </html>
>
> Which encoding has precedence? The http header or the processing
instruction?

I had a similar issue a while back - here's the thread:

http://markmail.org/thread/fsx3a3f225wwmphz

I think you use the content-type if it's present, if not you read the
first few bytes of the content in ascii looking for the prolog and use
the encoding specified there, finally falling back to utf-8 or utf-16.


--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.