PDA

View Full Version : Thai language



rhamej
September 7th, 2007, 12:40 AM
SOLVED =)

I've never worked with a foreign language before, so I'm a little stuck.

I built a simple backend that uploads data to a mySQL db using php.
The Thai language shows fine in the html textarea no problem.
However, I'm using php to create an XML file to yank the data.


<?php
$db = mysql_connect("localhost","XXXX","XXXX") or die("couldn't connect: " . mysql_error());
mysql_select_db("XXXX",$db) or die("no db: " . mysql_error());
header("Content-type: text/xml");
$xml_output = "<?xml version='1.0' encoding='utf-8' standalone='yes'?>\n<gallery>\n";
$sql = "SELECT * FROM gallery ORDER BY ID DESC";
$resultID = mysql_query($sql) or die (mysql_error());
while ($row=mysql_fetch_assoc($resultID)) {
$xml_output .= "\t\t<item>\n";
$xml_output .= "\t\t<description1>".str_replace("&nbsp;"," ",htmlentities($row['TITLE']))."</description1>\n";
$xml_output .= "\t\t<description2>".str_replace("&nbsp;"," ",htmlentities($row['COMMENTS']))."</description2>\n";
$xml_output .= "\t\t<link>".htmlentities($row['SRC'])."</link>\n";
$xml_output .= "\t</item>\n";
}
$xml_output .= "</gallery>\n";
echo $xml_output;

?>
The Thai characters are getting stored as unicode, like so: (with out the spaces, damn forum was converting it for me)


& #3650;& #3619;& #3591;& #3586;& #3634;& #3618;& #3618;& #3634;
The XML is writing it just like that and Flash is seeing it just like that.
How do I get Flash/PHP to convert that to Thai?

Thanks,
Josh

rhamej
September 11th, 2007, 01:48 PM
bump =)