"£" only displays some of the time

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

"£" only displays some of the time

Post by davidtube »

I've used this piece of code on two different pages of my site. One of the pages displays the British pound sign, the other shows a question mark in a box. Why is this?

Code: Select all

echo "£";
User avatar
seppo0010
Forum Commoner
Posts: 47
Joined: Wed Oct 24, 2007 4:13 pm
Location: Buenos Aires, Argentina

Post by seppo0010 »

Has to do with character encoding... It depend's on using utf-8, iso-8859-1... the correct way to do it is using the html entity for that character: £
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Post by davidtube »

Ah thanks, now I remember. But now if i have &pound50 it displays "&pound50". If i have &pound 50 it displays "£ 50" (with a space). How can I get rid of the space?
User avatar
seppo0010
Forum Commoner
Posts: 47
Joined: Wed Oct 24, 2007 4:13 pm
Location: Buenos Aires, Argentina

Post by seppo0010 »

You have to use a semicolon after &pound so it will be £50
davidtube
Forum Commoner
Posts: 79
Joined: Sun Mar 25, 2007 8:42 pm

Post by davidtube »

Great. Thank you
Post Reply