Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: problem of character set encoding in php

  1. #1
    Join Date
    Mar 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default problem of character set encoding in php

    I have a php form which submits information to an email. Everything works fine when dealing with 'normal' text. However, if a user submits "العربية", the resulting text displays as "د لله ".

    The website is in 3 languages (EN, FR, AR). Page encoding is unicode...


    Clearly it is an encoding problem, but I have looked around and cannot really see where to start to fix the problem. My php form submits to an external php file(contactus.php attached ), which in turn checks configuration information on an external text file.

  2. #2
    Join Date
    Mar 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    24 h up

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Page encoding is unicode...
    There are multiple Unicode encodings. UTF-8 is currently the most common, so I'll assume you mean that.
    Make sure you're setting the encoding of the email to UTF-8 too, add:
    Code:
    Content-Type: text/plain; charset=utf-8
    (or text/html, if you're using HTML email [which you shouldn't be, at least not without the user specifically saying they wish to receive HTML email]) to the headers.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the problem mr Twey is that mail informations (mailfrom, subject , body) coming from an other HTML file have (charset=utf-8) as header
    how can give variables( subject body) chareset utf8 ??
    for Example in ASP we have this :
    mail.BodyEncoding = Encoding.GetEncoding("utf-8")
    but in php how ??

    please help me

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I just told you.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    u p

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I'm not sure what that's meant to mean.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    thought there was a 5 min character limit.
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

  9. #9
    Join Date
    Mar 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    my question is very simple
    txt msg sent to me from a contact us with a chareset unknown

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    And my answer was just as simple:
    Quote Originally Posted by myself
    Make sure you're setting the encoding of the email to UTF-8 too, add:
    Code:
    Content-Type: text/plain; charset=utf-8
    (or text/html, if you're using HTML email [which you shouldn't be, at least not without the user specifically saying they wish to receive HTML email]) to the headers.
    Have you done this?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •