For some reason i get a Â
£76756687 weird character when i type a £ into a text field on my form?
-
does the form show it, or does it end up somewhere else? I'm guessing UTF-8/ISO-8859-1 missmatch – falstro Jan 14 '10 at 18:58
-
Is it a plain text or HTML email? – John Parker Jan 14 '10 at 19:06
-
You'll still need to set the encoding then - as long as the character set is the same on the email and form page all should be well. I'll update my answer. – John Parker Jan 14 '10 at 19:09
2 Answers
As you suspect, it's a character encoding issue - is the page set to use a charset of UTF-8? (You can't go wrong with this encoding really.) Also, you'll probably want to entity encode the pound symbol on the way out (£
)
As an example character set (for both the form page and HTML email) you could use:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
That said, is there a good reason for the user to have to enter the currency symbol? Would it be a better idea to have it as either a static text item or a drop down to the left of the text field? (Feel free to ignore if I'm talking arse and you're using a freeform textarea or summat.)

- 729
- 1
- 9
- 22

- 54,048
- 11
- 129
- 129
-
-
1The information inside the document is ignored if the information is already stated on a higher level like HTTP. – Gumbo Jan 14 '10 at 19:19
-
Are you storing the data in a database (or any intermediate area) prior to creating the email? (If so, have you checked the connection and table character sets?) – John Parker Jan 14 '10 at 19:19
You’re probably using UTF-8 as character encoding but don’t declare your output correctly. Because the £
character (U+00A3) is encoded in UTF-8 with 0xC2A3. And that byte sequence represents the two characters Â
and £
when interpreted with ISO 8859-1.
So you just need to specify your character encoding correctly. In PHP you can use the header
function to set the proper value for Content-Type header field like:
header('Content-Type: text/html;charset=utf-8');
But make sure that you call this function before any output. Otherwise the HTTP header is already sent and you cannot modify it.

- 643,351
- 109
- 780
- 844