Noah
Noah

Reputation: 3

Transforming XML in ISO-8859-1 to HTML

I have an XML document that I'm transforming using XSL and then spitting out directly into an HTML document (all server side).

Everything works OK functionally but special characters (specifically the © symbol -- these are ads and many have © symbols) don't show up right (IE shows ? and FF shows a diamond with a ? inside). Obviously something funky is going on encoding-wise.

The XML is in ISO-8859-1 encoding.

I tried adding <xsl:output omit-xml-declaration="yes" method="html" encoding="iso-8859-1"/> to my XSL file and <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"> to my HEAD tag in the HTML.

I was thinking of running the XML through a template (XSL) that converted all special characters to HTML equivs (© to &copy;) but I was hoping I don't have to go that route.

Any ideas?

Upvotes: 0

Views: 666

Answers (2)

Noah
Noah

Reputation: 3

Based on your answers (and my subsequent investigation) I realized that something was getting messed up higher up in the pipeline. I'm retrieving the XML from a web service and so I looked up in their API and found that I can have them encode the output in UTF-8. This works better for me anyway, so I ended up doing that and now don't have to worry about conversion etc.

Thanks for all your help!

Upvotes: 0

Rubens Farias
Rubens Farias

Reputation: 57946

I think your problem isn't XSLT related. You probably are missing your page return encoding (you know, like Response.ContentEncoding)

You can't easily convert © to &copy;

Upvotes: 1

Related Questions