Page 1 of 1

[Help] Displaying foreign language characters

Posted: Fri Feb 03, 2006 5:15 am
by surfinglight
Hi,

I had a problem displaying single and double quotes, and fixed the problem with addslashes and stripslashes.
Now I am stuck with another problem, which displays something like as follows for a foreign language character:
& # 243

How can I make foreign language characters appear correctly?

Your help would be greatly appreciated.

BTW, please kindly refer to the following steps I followed:

I stored data with addslashes and retrieved and displayed with stripslashes as follows:

$toshow = stripslashes($RetrievedFromTable);

echo $toshow; // displays the character correctly

$myemail = "test@test.com";
mail($myemail, $toshow, $toshow, "From: $myemail"); // shows funny characters like (& # 243) on the subject line and in the body of the email as well.

I have no idea why it shows correctly on "echo" but fails on email.


Many thanks in advance.

Posted: Fri Feb 03, 2006 7:56 am
by Weirdan
Most probably you've received the data in this form. It's called html entities.
Whether or not user agent (browser) sends the data in form of html entities, I believe, is controlled both by the character set of the page, containing the form you used to gather the data and the form's accept-charset attribute. Make sure you specify the proper character set in Content-type header. If you don't know the language of the data in advace, natural selection of character set would be the UTF-8.

Posted: Tue Feb 07, 2006 2:33 am
by surfinglight
This was what I did:

-I insert data with addslashes()
-Retrieve it using SELECT statement, and send an email as follows:

$toshow = stripslashes($RetrievedFromTable);
$toshow = utf8_decode($toshow);
$toshow = html_entity_decode($toshow, ENT_NOQUOTES);

$emailaddress = "test@test.com";
mail($emailaddress,$toshow,$toshow ,"From: $emailaddress\nContent-type: text/html; charset=utf-8\n");


Still receiving & # 243; in a subject line of the email.

What am I doing wrong?