[thelist] IIS / formatCurrency Problem

Andrew Clover and-evolt at doxdesk.com
Fri Oct 31 06:04:34 CST 2003

Bob Thomson <bob at nkd-webmedia.co.uk> wrote:

> The problem is that once in a while when you open a page every ? sign is
> preceded by a "?" character.

This would occur if you were outputting your page in the UTF-8 encoding
(where the UKP sign is encoded as 0xC2, 0xA3), but the browser was
misinterpreting it as Latin-1 (or the similar Windows codepage). In this
encoding the sequence comes out as a A-circumflex followed by (semi-
coincidentally) a pound sign.

Judging by the way this occurs intermittantly, the likely cause is that
you haven't told the browser what the character set is at all, so it has
to guess. Depending on what other characters you have used in the page,
it might guess either UTF-8 or Latin-1.

The solution is to pass a Content-Type header specifying the correct
character encoding in the HTTP response. This can also be done in HTML
with a meta hack:

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

Andrew Clover
mailto:and at doxdesk.com

More information about the thelist mailing list