before £ in online form. HELP?

by 9 replies
11
Does anyone know why my php contact form is delivering the email message and displaying 'Â' before the '£' symbol as shown below in the email I receive from the online form?

Monthly Salary: £700 - £1000

This is the html I am using is:

HTML Code:
<option value="&pound;700 - &pound;1000">&pound;700 - &pound;1000</option>
I'm sure its very simple, but any help appreciated to point me in the right direction?

Thanks
#programming #form #online
  • This might shed some light on the problem:
    Fyneworks: British Pound Sign Encoding Revisited
  • Just a guess here, but looks like it might be a character encoding issue. Do you see a line of HTML code in the <head> section of that page that looks like...

    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />

    If so, try changing it to this and see if that fixes it...

    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    • [ 1 ] Thanks
    • [1] reply
    • Hi Brandon, it already says ('Content-type: text/html; charset=utf-8');

      I'm a bit perplexed!
      • [1] reply
  • I agree with Brandon Tanner.

    It sounds like your issue is character encoding related. It's not a fun topic to dig into, but it's important to understand how character encodings can affect your sites, databases, and other applications. The quick and currently accepted answer to the problem is to switch to UTF-8. (Note, be wary of UTF-16 if you're planning on using it)

    If you haven't had the opportunity to read over why this is important, Joel of Fogcreek Software has a very straight forward write up on what developers should know about character sets.

    Also note that you may use a shorter syntax in HTML5!

    Have fun!
    • [1] reply
    • Are you looking at the content type of the email that you're receiving or the HTML of the contact form? Both the email and the HTML page should be character encoded.
  • My best guess is that you're using the mail() function in php to send yourself the email, which does not send you the message in UTF-8 by default. Knowing how to do this will help you deliver mail better to your customers/clients without having encoding issues. Here's how you do it:


    $to = "YOUR_EMAIL_GOES_HERE@email.com";
    $subject = "=?UTF-8?B?".base64_encode('Subject Goes Here')."?=";
    $headers = "From: NAME GOES HERE <FROMEMAILGOESHERE@email.com>\r\n".
    "MIME-Version: 1.0" . "\r\n" .
    "Content-type: text/html; charset=UTF-8" . "\r\n";
    $message = "YOUR EMAIL GOES HERE";

    mail($to, $subject, $message, $headers);

    That should solve it, if not let us know. Because if you're sending emails to users/customers/clients using your current system they're also not getting properly encoded special symbols which is bad.
  • Whups double post

Next Topics on Trending Feed

  • 11

    Does anyone know why my php contact form is delivering the email message and displaying 'Â' before the '£' symbol as shown below in the email I receive from the online form? Monthly Salary: £700 - £1000