views:

158

answers:

2

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?

+1  A: 

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;

Rubens Farias
I'm using C#, so I added Response.ContentEncoding = System.Text.Encoding.GetEncoding("iso-8859-1");but now even in FF they show up as just ? marks
Noah
can you please post your c# transformation code?
Rubens Farias
Strange… accepted but no explanation.
Tomalak
Noah
A: 

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!

Noah