I’ve been using, for example, the degree character entity ° in my source xml and it was always output as ° after translation and worked fine. However, I’ve recently had to switch from a xalan processor to saxon and now the character is being output as an actual degree character (°) in the html and the browser is rendering it as ¬∞.
I’m not really sure why it worked in xalan but I was searching around and thought character maps would be the solution from what I found in this page:
http://www.xmlplease.com/xmltraining/xslt-by-example/examples/character-map_1.html
But when I do the same thing it just appears to be ignored and I still see the °.
Again, I’m using saxon9 with the xslt task in ant with java6. I’d like my ° character in xml be preserved (or changed to °) when translating to html. Any suggestion?
It looks like the new output is not marked as UTF-8?
Most often, when one character becomes two, it’s because you send UTF-8 to the browser saying it’s another encoding (i.e. ISO-8859-1, win-1512, etc.). Putting UTF-8 encoding in the HTML header may not be enough. You probably also need to put it as a header in the HTTP reply.
Using ° should not help if the XSLT parser transforms all the entities.
Otherwise, there may be a flag you can set to avoid the translation of entities?