473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

umlaut in mail sent by php?

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

Jul 17 '05 #1
6 4072
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: ma**@japanesetranslator.co.uk
http://www.japanesetranslator.co.uk
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Jul 17 '05 #2
NC
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

Jul 17 '05 #3
"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
Jul 17 '05 #4
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/
Jul 17 '05 #5
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
Jul 17 '05 #6
Philip Ronan <in*****@invalid.invalid> wrote in
news:BE467201.2C022%in*****@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
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lukas Kasprowicz | last post by:
Hi Folks, I have a string filled with much text converted from a tuple. when I try to do someting like this: exclusion = re.sub("\\xf6", "%F6", exclusion) # ö exclusion = re.sub("\\xfc",...
11
by: Jürgen Kahrs | last post by:
Hello, do you think that this file is a proper Unicode file? http://belnet.dl.sourceforge.net/sourceforge/ganttproject/ganttproject-example3.xml <?xml version="1.0" encoding="UTF-8"?> ......
3
by: Pekka Jarvela | last post by:
I am using Visual Studio C++ .NET and when I try to print words with umlaut letters, for instance printf("Pässinpää-ääliö"); letters with dots over them, äö, will not be printed correctly on...
6
by: DigitalRick | last post by:
I have been running CDONTS in my ASPpages to send emails to me sent from my guestbook. It had been working fine untill I upgraded to Server 2003 (I am also running Exchange 2003) all locally. I...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
1
by: Reinier | last post by:
Hi all, When I try to get the parameter from an ASP.NET page, all characters with a umlaut disappear. So when I request the following URL: http://www.MyWebsite.com/MyPage.aspx?Name="Müller" ...
1
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
11
by: cody | last post by:
Is there a method to replace special characters like Ä (A-Umlaut) with A, Ö (O-Umlaut) with O, and so on? Sure, I could look for each character separately and replace it with its...
9
by: Keith G Hicks | last post by:
I have a vb app that runs on a server. It periodically checks for rows in a table that are ready to have data mailed out to clients. After it finds row(s) that are ready, it emails the info out and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.