0

I have an asp page rendering some text from a table into html. Some of the text has the non-breaking-space   character in it (unicode U+00A0). The browser auto-detects the character encoding to be unicode, which is good, but it isn't rendering the   correctly. It is rendering them as � (the replacement character). When I change the page encoding to be "Western" instead of "Unicode", the � characters disappear.

Shouldn't the non-breaking-space be a normal character for a Unicode encoded web page to render? What is happening to cause this?

I have verified that the character stored in the database is the non-breaking-space by using SQL Server's ASCII and UNICODE functions, both return 160.

Also, when I run this code snippet String.fromCharCode(160) it returns " ", so the browser does seem to understand that character is supposed to be a space. Could the ASP be messing those characters up between querying them and writing them as html?

jabe
  • 784
  • 2
  • 15
  • 33

1 Answers1

0

The asp file was saved with ANSI encoding. Switching the file's encoding to UTF-8 solved the problem. I'm guessing even though the page said it's charset was UTF-8, it really wasn't. This explains why 'Western' encoding worked while "Unicode" did not.

jabe
  • 784
  • 2
  • 15
  • 33