PDA

View Full Version : PHP special character question



Ludovic
May 29th, 2004, 07:26 PM
Hi

I have a flash application that sends a string to a PHP file who sends it back via email.

Looks like this:

on(release){
my_lv = new LoadVars();
my_lv.LASTNAME = escape(LASTNAME);
my_lv.FIRSTNAME = escape(FIRSTNAME);
my_lv.EMAIL = escape(EMAIL);
my_lv.send("http://carpell.com/MAILSENDER.php", "POST");
}

and in teh php file, i use the function urldecode() to decode the string, but when special characters are in the string, they become "phuked up"

like "é" becomes é and things like that..

ex : Jetté : jetté

plz help me !

Ludovic
May 30th, 2004, 08:42 PM
I fixed my problem. I made lots of string_replace and now it works perfectly. If anyone has this problem, mail me ill send the table. :)

Hans Kilian
May 31st, 2004, 05:14 AM
Your string isn't garbled. It's just utf-8 encoded.

There is an utf8_decode function in PHP (http://dk2.php.net/manual/en/function.utf8-decode.php), but since there are more letters available in utf-8 than in a one-byte character set, there are bound to be letters that can't be converted...

Hans Kilian
May 31st, 2004, 05:20 AM
You can also convert the special characters to HTML entities using mb_convert_encoding


$string = mb_convert_encoding($string, 'HTML-ENTITIES', 'UTF-8');