View Full Version : Character sets and the GBP symbol

08-16-2005, 12:13 PM
Hi all,

I was having a bit of a problem properly displaying the GBP symbol () in some tax calculators I created.

Basically the user types their entries and the answer is presented in a form text field with a preceeding sign. This works on every server I've installed it so far until today. For some reason the is being replaced with a ? on both IE and FF.

I double and triple checked my script and nothing worked. I then tried just doing:

<script type="text/javascript">
And even this doesn't work. Upon further investigation it seems the server is set to use UTF-8 character encoding whereas all the other servers are using iso-8859-1. To test my theory that this was causing the problem, I created the following script on my local machine:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
And I get the same problem. So it seems that the issue is the UTF-8 character set, but I don't understand why - I thought iso-8859-1 was a subset of UTF-8 and anything that worked in iso-8859-1 should therefore work in UTF-8?

Since there's no chance of me getting the admin to change the server config (I can't even do it via .htaccess, I tried), does anyone know a workaround for this problem? I tried using the character codes &#163; and &#xA3; and I also tried using &pound; but the problem is when these are echoed to the text field they appear as they are typed instead of appearing as a symbol.

Anyone have any ideas?

08-16-2005, 05:22 PM

this is the way javascript handle unicode characters. '\uhexaval'

and should work without specify the unicode charset if dealing with HTML...i guess... It works for me on a simple charset=iso-8859-1.

08-16-2005, 05:29 PM

08-17-2005, 10:37 AM
That works perfectly, thanks Kor :thumbsup:

08-17-2005, 10:40 AM
:thumbsup: You're welcome... Even I don't know if you like Manchester United team as I do... ;)