This is a discussion on umlaut in mail sent by php? within the PHP Language forums, part of the PHP Programming Forums category; Hi, I am trying to send emails with the php Mail function, but umlaut and other special characters are not ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
I am trying to send emails with the php Mail function, but umlaut and other special characters are not displayed correctly. Actually they are replaced by large X's. I checked if there is an error on the receiving side, but both thunderbird and squirrelmail do the same! any Idea what is wrong? do I have to make a mb_string_recode? but to what charset? The emails are sent in UTF-8 encoding, and the umlaute in the email body display just perfectly! Oliver |
|
|||
|
Oliver Spiesshofer wrote:
> Hi, > > I am trying to send emails with the php Mail function, but umlaut and other > special characters are not displayed correctly. Actually they are replaced > by large X's. I checked if there is an error on the receiving side, but > both thunderbird and squirrelmail do the same! > > any Idea what is wrong? do I have to make a mb_string_recode? but to what > charset? > > The emails are sent in UTF-8 encoding, and the umlaute in the email body > display just perfectly! > > Oliver Are you saying they appear correctly in the email body, but not in the headers (subject, etc.)? I think internet headers have to be sent as 7-bit data. To send non-ASCII characters you have to use an "encoded word" as defined in RFC 2047. For example, "München" can be encoded like this: =?iso-8859-1?q?M=FCnchen?= Obviously that uses iso-8859-1 encoding, but you get the picture. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= PHILIP A. RONAN Freelance Japanese Translator 205 Hamlin Lane, Exeter EX1 2SQ, England Tel/Fax: +44 (0) 1392 435019 Email: mail@japanesetranslator.co.uk http://www.japanesetranslator.co.uk =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= |
|
|||
|
Oliver Spiesshofer wrote:
> > I am trying to send emails with the php Mail function, but > umlaut and other special characters are not displayed correctly. > Actually they are replaced by large X's. I checked if there > is an error on the receiving side, but both thunderbird and > squirrelmail do the same! > > any Idea what is wrong? Try this: $subject = mb_convert_encoding($subject, 'ISO-8859-1', 'UTF-8'); And make sure you have this header: Content-Transfer-Encoding: 8 bit Cheers, NC |
|
|||
|
"NC" <nc@iname.com> wrote in news:1109354489.489314.276270
@g14g2000cwa.googlegroups.com: > $subject = mb_convert_encoding($subject, 'ISO-8859-1', 'UTF-8'); thats what I did now. Hoever, it still does not arrive in the end properly. Here is the part of my headers: Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Berliner Techno-Club Tresor schlieXt nach 15 Jahren The script which is doing it now produces a logfile, and the title in the logfile is correct! If I use ASCII instead of ISO as an encoding, I get a ? instead of a X for invalid letters.... any other ideas what I could do? Oliver |
|
|||
|
Hello,
on 02/25/2005 08:51 AM Oliver Spiesshofer said the following: > I am trying to send emails with the php Mail function, but umlaut and other > special characters are not displayed correctly. Actually they are replaced > by large X's. I checked if there is an error on the receiving side, but > both thunderbird and squirrelmail do the same! > > any Idea what is wrong? do I have to make a mb_string_recode? but to what > charset? > > The emails are sent in UTF-8 encoding, and the umlaute in the email body > display just perfectly! You do not need to encode in UTF. You just need to encode with quoted-printable for characters in the body and q-encoding for characters in the headers. Take a look at this class can can encode and send messages properly and even comes with an example of how to send messages with accents: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html |
|
|||
|
Oliver Spiesshofer wrote:
>> $subject = mb_convert_encoding($subject, 'ISO-8859-1', 'UTF-8'); > > thats what I did now. > Hoever, it still does not arrive in the end properly. > Here is the part of my headers: > > Content-Type: text/html; charset=utf-8 > Content-Transfer-Encoding: 8bit > Subject: Berliner Techno-Club Tresor schlieXt nach 15 Jahren That's because you're putting 8-bit data in a mail header. Mail headers can only contain 7-bit data. I mentioned that already. > The script which is doing it now produces a logfile, and the title in the > logfile is correct! If I use ASCII instead of ISO as an encoding, I get a ? > instead of a X for invalid letters.... That's because there is no umlaut in the ASCII character set > any other ideas what I could do? 1. Read RFC 2047 2. Read my last post in this thread -- phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/ |
|
|||
|
Philip Ronan <invalid@invalid.invalid> wrote in
news:BE467201.2C022%invalid@invalid.invalid: > 1. Read RFC 2047 > 2. Read my last post in this thread thanks. I got now what you meant. I found the (IMHO) easiest way to deal with it. I simply run the subject through a mb_encode_mimeheader(). This worked very nicely. Oliver |
![]() |
| Thread Tools | |
| Display Modes | |
|
|