1
votes

Can anybody tell me why a page source view of a xslt styled Amazon AWS xml file displays with:

encoding="iso-8859-1" when viewed in IE

but displays with:

encoding="UTF-8" when view in page source view in FF and Safari?

The file is exactly the same file. The styling works in IE but not FF and Safari.

Many thanks

Updated

Here is the first few lines of the xslt sheet.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
<xsl:output method="xml" version="1.0" encoding="iso-8859-1" indent="yes"/>
<xsl:template match="/">

The first 3 lines of the XML file (showing embedded xslt which isn't there in the xml created by the call but are in place to try to check the xslt) are:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://www.wiiuser.co.uk/xmlxslt.xslt" type="text/xsl" ?>
<BrowseNodeLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">

FF & Safari interprets the output of the xslt as "UTF..." IE as "iso..."

1
Could you, please, provide a small example-transformation and XML document? Does this happen only when AWS is used or can this be demonstrated without involving AWS?Dimitre Novatchev
Hi Dimitre - I'm still stuck. I have identified that the source code view from IE (as you showed me) is exactly what I'm after. The page source in the other browsers is wrong. Therefore AWS must be reading the xslt sheet in the same way as FF and Safari. There must be something wrong in the xslt which I can't see. I think need to rewrite it but even stipping out everyting I can't get AWS to style the xml before it returns it.Mark_54

1 Answers

2
votes

The default encoding when the document does not specify explicitly one, is different between the different browsers. If I remember correctly, IE is attempting to match the system locale, while FF/Safari just default to UTF-8.

As to why that would break it - I'd venture to guess you have somewhere in the XML a character from the upper half of the ANSI table, which when read as UTF-8, messes up the stream of chars after it.

One way you can fix this is to explicitly state the encoding of the XML document in the <xml> processing instruction.