Multilanguage in PHP feedback forms

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
silverphpd
Forum Newbie
Posts: 3
Joined: Tue Feb 24, 2004 12:24 pm

Multilanguage in PHP feedback forms

Post by silverphpd »

Hi,

When I send non-English text in PHP online feedback forms, it comes as garbage in email client.

The webpage has 'charset=UTF-8' so it gets & sends right text, the php script use right mail call as here:
mail($mailto, $subject, $message,
"From: \"$name\" <$email>\nReply-To: \"$name\" <$email>\nX-Mailer: chfeedback.php 2.01" );

Please advice how it can be fixed.
Thanks.
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

Hm, hard to say. Actually German Umlaute should work but you probably mean something really diffrent like Russian or Chinese. Maybe you need to do something with the main headers?
Read the user's comments in the mail manual [php_man]mail[/php_man] to learn how to control the mail headers.

BUT this is just my guess!
silverphpd
Forum Newbie
Posts: 3
Joined: Tue Feb 24, 2004 12:24 pm

Post by silverphpd »

Fredix wrote:...Maybe you need to do something with the main headers?...
Fredix, you are right. I fixed it, now the other problem.
My email, comming from online PHP form, lost all newline characters.

It happend after I added additional header for PHP mail() call, like this one:

MIME-Version: 1.0\nContent-type: text/html; charset=utf-8

How can I get newline characters back?
Thanks.
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post by Fredix »

MIME-Version: 1.0\nContent-type: text/html; charset=utf-8

means that you send a html file as a mail, therefore linebreaks must be also done with html <br />

btw: sending html mails means that you are sure that all your clients are able to read a html formatted email! (if they do not have the software for it but use text-only software PROBABLY they will be able to read the mail but also will see <p>, <br />, ... as text)
silverphpd
Forum Newbie
Posts: 3
Joined: Tue Feb 24, 2004 12:24 pm

Post by silverphpd »

Thanks a lot. Now it's fixed.
Post Reply