Advanced Search

Results 1 to 3 of 3

Thread: Stopping foreign characters from being garbled

  1. #1
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Stopping foreign characters from being garbled

    I have forms on some of my web pages the contents of which are automatically forwarded via email when visitor clicks send.

    The problem is when the visitor types in a foreign character such as an accented letter or currency symbol, this displays ok in the form but gets garbled by the time it reaches my mailbox.

    Does anyone know how to handle this.
    Cheers
    Billy

  2. #2
    Join Date
    Aug 2006
    Posts
    239
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The mail and page encoding must match.
    Short answer: Content-encoding: utf-8.

    Long answer, let the document containing form have Unicode encoding- that takes care of almost all characters, and if it's sent via oridinary "mailto:" protocol, that should be automatically recognized and converted by mail clients.
    Other thing is that if the form is submitted to a script that mails it content, it's even easier:

    In PHP, for example you have
    Code:
    mail("myadress@the.net", "Form data", $formcontent,
    "MIME-Version: 1.0\n".
    "Content-encoding: utf-8\n")
    and that's it, it takes care about encoding

  3. #3
    Join Date
    Jul 2005
    Posts
    101
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply. My document encoding is UTF-8. The input is directed to formmail.cgi provided by the web host, but I cannot modify this program. So is there a full php script I can use to do the same thing? It just needs to forward the input from the form and there will not be attachments.
    Cheers
    Billy

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •