before £ in online form. HELP?

9 replies
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
#form #online
  • Profile picture of the author KirkMcD
    This might shed some light on the problem:
    Fyneworks: British Pound Sign Encoding Revisited
    {{ DiscussionBoard.errors[6589812].message }}
  • Profile picture of the author Brandon Tanner
    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" />
    Signature

    {{ DiscussionBoard.errors[6589829].message }}
    • Profile picture of the author Justin B
      Hi Brandon, it already says ('Content-type: text/html; charset=utf-8');

      I'm a bit perplexed!
      {{ DiscussionBoard.errors[6590434].message }}
      • Profile picture of the author Brandon Tanner
        Originally Posted by Justin B View Post

        Hi Brandon, it already says ('Content-type: text/html; charset=utf-8');

        I'm a bit perplexed!
        Hmmm... no idea, then. If the 'Â' is being produced on the server side, then as a last resort you could just do a PHP string replace right before that value gets sent to the browser (assuming you know where that part of the code is located, and are comfortable editing it).

        For example...

        <?php
        $value = "Monthly Salary: £700 - £1000";
        $fixed_value = str_replace("Â","",$value);
        ?>


        $fixed_value would then return "Monthly Salary: £700 - £1000"

        Not the most elegant solution, but it should work if the problem is indeed on the server side.
        Signature

        {{ DiscussionBoard.errors[6591168].message }}
        • Profile picture of the author Justin B
          OK, so what I have noticed is that the  only appears in the emails in my windows live email, but does not show in my gmail, iphone or ipad.

          So, must be something in my windows mail that is doing it,
          {{ DiscussionBoard.errors[6601149].message }}
  • Profile picture of the author Workman
    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!
    {{ DiscussionBoard.errors[6590478].message }}
    • Profile picture of the author Workman
      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.
      {{ DiscussionBoard.errors[6590527].message }}
  • Profile picture of the author ALicenseToCode
    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.
    {{ DiscussionBoard.errors[6591121].message }}
  • Profile picture of the author ALicenseToCode
    Whups double post
    {{ DiscussionBoard.errors[6591129].message }}

Trending Topics