Web Hosting Talk







View Full Version : problem of character set encoding in php


dr-support
04-08-2007, 06:02 AM
have a php form which submits information to an email (txt mail not html mail). Everything works fine when dealing with 'normal' text. However, if a user submits "العربية", the resulting text displays as "د لله ".

The website is in 3 languages (EN, FR, AR). Page encoding is unicode...


Clearly it is an encoding problem, but I have looked around and cannot really see where to start to fix the problem. My php form submits to an external php file(contactus.php attached ), which in turn checks configuration information on an external text file.

horizon
04-08-2007, 09:53 AM
You could build language packs which PHP could detect under a while-loop. Each users could then select their prefered language. Each selected language could be captured in your PHP file and then send the email with the right CHARSET setting. ;)

dr-support
04-08-2007, 12:28 PM
my html page work fine only with charset=utf-8 but form contact us sent msg withe an other charset :(
I want do as this in php :
for Example in ASP we have this :
mail.BodyEncoding = Encoding.GetEncoding("utf-8")
but in php how I can do this ??

horizon
04-08-2007, 12:53 PM
but in php how I can do this ??

This page should give you an hint:

http://ca.php.net/mail

Take a look at their examples. ;)

Renard Fin
04-08-2007, 03:07 PM
In a more general mather, i'd say that utf8_encode & utf8_decode should maybe help.

azizny
04-08-2007, 05:04 PM
utf8 will always work for any language.

It will appear on the database and the webpage.

Peace,