Re: [xsl] &#160 appearing as ? in FF and IE

Subject: Re: [xsl] &#160 appearing as ? in FF and IE
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Thu, 21 Sep 2006 08:53:50 +0200
Hi Steve,

I once had such problem with &nbsp;, encoding it as &#xA0;. Resolving it did not mean just setting the content-type inside the html head (must be in the head!), but also, and more importantly, inside the HTTP headers you send.

I do not think this is an xslt problem, but to find out, you can open up your HTML output inside a texteditor capable of handling UTF-8. Furthermore, I myself followed the following procedure to find out if it is going wrong in the output of the XSLT processor.

STEP 1
1. Needed: html output from processor, hex editor
2. This is your stylesheet:
<html><body>A&#xA0;A</body></html>
3. Output should be something similar to the above. Now, open this in hex editor.
4. Read carefully. You should see the hex characters xC2xA0 (between two x41 bytes, these are the A-chars). This is the UTF-8 encoded byte-sequence for U+00A0, the No-Break Space. You will see it between brackets, or between normal whitespace.
5. If this is correct, your XSLT processor does a good job and you can go on with the next step.


STEP 2
The file, as it is served by your Apache or IIS or whatever: save it to disk and try to find the same byte-sequence as explained above. If it is missing, or if it is replaced with something else, the problem may be in the HTTP sending. Check Apache/IIS in that case and you HTTP headers.


STEP 3
If it is still containing the xC2xA0 byte sequence, you should check the encoding found by the browser, for FireFox: View --> Character Encoding (but I assume you know the drill, you watched the FAQ ;-)


STEP 4
Finally, you should check your font mapping. If you are on Windows, you can do so by choosing Character Map (Run --> "charmap" + Enter). Select your font (the font you use in CSS, in the style-tag of your element or, if none, the font selected by IE or Firefox, mostly Arial or Times) Search for "space". It will give you U+00A0, or nothing, if it is not there.


What I often found is that my JSP, serving the HTML, made a mistake somewhere and forgot that it was dealing with UTF-8 (not sure if you server your XSLT output directly) and instead translated it to Latin-1 or worse, messing up my characters badly. If this is the case, you will find a different byte seq. in STEP 2. Also, you should really check your HTTP headers. You can do so in FireFox with "View Page Info".

Hope this helps you a bit further resolving this,

Cheers,
Abel Braaksma
http://abelleba.metacarpus.com

Steve wrote:
Anyone have any ideas why & # 1 6 0 ; is rendering as '?"'s? when both
browser and
xsl:output is set to UTF-8?

Did change charsets to UTF-8 in FF and IE and the ?'s will not go away.

Meta tag:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

xsl:output:

<xsl:output method="html" encoding="UTF-8" indent="yes" />

-Steve

ps: yes, I see that. =) Frequently asked and frequently unconcluded.

ps: Its hard to search for documents on specific characters =) I found
a few but nothing helpful.

On 9/11/06, David Carlisle <davidc@xxxxxxxxx> wrote:

Current Thread