Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
February 26, 2009, 6:31 pm
rate this thread
I am trying to write a PHP script to decode multi-part emails and I am
having two problems that I haven't been able to solve.
Problem #1 Non ascii characters
For example, the accented characterA6 is converted to =E9 by many
email programs (gmail for example) and sent in the ISO-8859-1
charset. Here is an example email:
Content-Type: text/plain; charset=3DISO-8859-1
I want to convert =E9 back into anA6 and I am trying to use
quoted_printable_decode(). The problem is that quoted_printable_decode
() assumes that the charset is UTF8 so it doesn't work. In UTF8,A6 is
represented as =C3=3DA9.
So, is there a way to decode quoted printable characters in charsets
other than UTF8?
Problem #2 Multi-byte languages
Languages like Chinese and Russian have an different problem. An
email sent with the Chinese charactershD6 looks like this when I g=
Content-Type: text/plain; charset=3DISO-2022-JP
How do I convert this back into the real Chinese characters?
February 27, 2009, 10:39 am
Re: Question about UTF8, Quoted printable and other charsets and encodings
Both work for me. Perhaps the problem is in whatever you do later with
the result. For instance, if you want to display it in a web browser you
have to set the proper charset in the Content-Type header:
header('Content-Type: text/plain; charset=iso-8859-1');
Does it look right if you output to a web browser with the Content-Type
header? You should see Japanese chars if your browser supports eastern
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
- » Request Help : Passing POST variables from on page to another
- — Next thread in » PHP Scripting Forum