Simon Heffer
Simon Heffer

Reputation: 141

Inconsistent display of unicode characters on web pages

I have a C program that outputs some data including unicode non-English characters. It works fine in a Windows 7 command window, a Linux telnet session but used to fill a Label field on a ASP/html page it doesn't work in all situations - the platform that the web server is running on seems to affect the output.

Where I have a machine running Windows XP SP3 the program works fine in a command window but in the web page the characters are wrong. e.g. Ø is displayed as Ï.

The web page works fine where the web server is on Windows 7 and Server 2003 SP2. Web browser choice makes no difference.

Upvotes: 2

Views: 1266

Answers (2)

Jukka K. Korpela
Jukka K. Korpela

Reputation: 201768

When Ø (U+00D8) is displayed as Ï (U+00CF), the probable explanation is that the HTML page is ISO-8859-1 or Windows-1252 encoded but the browser is interpreting it as CP 850 encoded. Check this using View → Encoding in your browser (it will show you the current encoding being applied to interpret the page, and you can change that to Windows-1252, which exists under some name (like “Western European (Windows)”) there. – There are some other encodings in which the byte 0xD8 is interpreted as Ï.

If this turns out to be the right explanation, and even if not, check the actual and declared character encoding of the page and make sure that they match. See the W3C page Character encodings.

Upvotes: 1

Klas Lindbäck
Klas Lindbäck

Reputation: 33273

The problem is probably one of character encoding.

The character encoding can be specified in each page or by setting a default value in the web server.

The Windows XP IIS probably has ISO-8859-1 as the default character set. you can either change it by configuring IIS or by specifying the character set in each HTML page.

Upvotes: 1

Related Questions