Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

How to make accents show properly in mail sent by PHP

12:10 am on Dec 11, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:May 2, 2002
votes: 0

I have a PHP script that sends an email in spanish and I get strange characters instead of accents.
I have tried the following headers:

Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

(each line separeted by a
But I get strange chatacters where accents and other special characters are supposed to appear (, etc).

How can I fix this?

I don't think it is the e-mail client, because I get e-mail in spanish from others and I can see the accents and all. I even copied the headers from those messages, but no luck.

6:39 pm on Dec 13, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:May 2, 2002
votes: 0

Now I see why no one answered, it's not easy.
The headers that have to be sent are:

Mime-Type: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-encoding: 8bit

That's not enough.
I have found that the extended ASCII set IS NOT the same for iso-8859-1.
If I type an (acute accented a), the ASCII code is 135.
But to iso-8859-1, character number 135 is a .
This is where the problem begins.
The in iso-8859-1, is ASCII 255... go figure.
I'm new to this, so I don't know if there is supposed to be any logic between these two charsets, fact is, you cannot get all iso-8859-1 characters by adding or substracting a fixed number to the ASCII number.
I mean, if you add 135+90=255, but if you add 142 ()+90=.

I'm clueless, I'm starting to think that I have to map each individual character to make the appropiate "translation" so that these characters arrive readable by e-mail.

Any ideas? Can this be explained?
Why fry my brain on this? because accented characters and other special characters are important in spanish, it is not the same "contrasea" than "contrasena" or "envo" to "envi", and I am sure other languanges need their own special characters too.