View Full Version : Resolved Displaying currency in XHTML

Sep 15th, 2009, 12:10 PM
Hi all,

My DOCTYPE is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

and my charset is UTF-8...

I'm trying to display the sign through the use of php but it is displaying as a ? mark in Firefox... then when I try and validate it i get the following error from W3C...

" Sorry, I am unable to validate this document because on line 198 it contained one or more bytes that I cannot interpret as utf-8 (in other words, the bytes found are not valid values in the specified Character Encoding). Please check both the content of the file and the character encoding indication.

The error was: utf8 "\xA3" does not map to Unicode "

I realise I need to change the charset, but I've absolutley no idea which charset I need to use to allow currency symbols :confused:

Can anyone advise?

Many Thanks,


Sep 15th, 2009, 12:20 PM
UTF 8 should be perfectly fine for currency symbols. I suppose despite having it set in the document header somehow your document is sent as something other than UTF 8. Sometimes this happens if you validate your documents through manual input or upload and should be OK if the document is on a web server but I don’t know if that applies to you.

However, to avoid any confusion you can always use the respective HTML entity which is &pound;

Sep 15th, 2009, 12:24 PM
Hi Stephen,

Thanks for your reply...

The page in question is indeed currently sitting on a webserver, and is being validated through URL not upload or input.

Using the &pound; is not an option I'm afraid as this data is fed by employers and then into a database and back out onto the page.

Not sure if it will help you see the problem but my page is:



Sep 15th, 2009, 12:42 PM
Is it possible ffor your to allow them to enter the sign and for your script to convert it to &pound? Then when the page displays it, it will show the instead.


Sep 15th, 2009, 12:59 PM
Hi Bazz,

It's a hard one for me to answer really, as the PHP backend coding was already in place when we bought the jobs board software & my knowledge of PHP is minimum...

The only other solution I could think of was to explicitly set the pound sign in the xhtml (as mentioned above) before the PHP began and ask the employers not to set the pound sign, however because there are already over 100 jobs in the database, this would be a nightmare to try and impliment!

Sep 15th, 2009, 02:16 PM
however because there are already over 100 jobs in the database,
Use htmlentities (http://php.net/htmlentities)()

Sep 15th, 2009, 02:33 PM
Many thanks abduraooft, exactly what I needed!

Another lesson learnt.