Converting £ symbol to £

My database is full of user inputted data which has loads of pound symbols in it ‘£’. BUt they output as a strange character.
I know if I change them to £, they appear correctly but how can I do that en-masse.

So far I have tried these options

echo str_replace(“£”, “£”, $row_rs_deals[‘description’])
echo htmlspecialchars($row_rs_deals[‘description’])

But neither work.

Does anyone know what will convert them? Also, would it be better to convert them on the way into the databse in the future or is that impossible?

Cheers

Dave

I don’t know if this will work, but give it a try:

Instead of this:

echo str_replace("£", "£", $row_rs_deals['description']);

try this:

echo str_replace(chr(156), "£", $row_rs_deals['description']);

Mike

Close but no cigar! Still get a little square instead of the pound symbol.
Any other ideas?

Ah well. It was just a shot in the dark. I hope someone else will give you the answer.

Mike

I don’t know what is your character set in your page but did you try htmlentities() function something like this ?


echo htmlentities('£hello', null, 'utf-8');

You should just use UTF-8 then you can use the symbol without any conversions. ¢£¤¥

UTF 8 as the characterset for the database table?