Flashproblems using specialcharacters (å,ä,ä etc) from database

202 Views Asked by At

I have a problem with a flashpage I am developing. It sends a request to a database through a php-file and retrieve a text that I place in a textfield. The problem is that the swedish and other specialcharacters is shown in code format looking like this \u00e4 . I know both my php-file and database is correct because I have used the same request with the same php-file and database in a android app and it works perfect.

Do anyone know if there is some kind of code as utf-8 or simular function in flash actionscript 3.0 in cs3.

<?php 
header("Content-type: text/html; charset=utf-8"); 

$con = mysql_connect("localhost","db","psw");
if(!$con)
{
die(' not working: ' . mysql_error());
}
mysql_select_db("dbname", $con);
mysql_set_charset('utf8');

if($_REQUEST['sort']=='categories'&&$_REQUEST['prg']=='flash')
{
$q=mysql_query("SELECT * FROM ".$_REQUEST['sort']." ORDER BY id");
while($e=mysql_fetch_assoc($q)) //assoc
     $output[]=$e;
echo $output;
}

mysql_close();
?>

Thanks for the help/micke

1

There are 1 best solutions below

1
On

Try a simple escape() on your string before sending it away.

escape("\u00e4"); // returns %20%E4, which php should interpret as "ä"

Potentially in php a urldecode() may be required.