Jump to content

Thai language help


rhamej

Recommended Posts

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 into a Flash app.

<?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(" "," ",htmlentities($row['TITLE']))."</description1>\n";
        $xml_output .= "\t\t<description2>".str_replace(" "," ",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 in the db, like so:

&#3650;&#3619;&#3591;&#3586;&#3634;&#3618;&#3618;&#3634;

The XML is writing it just like that as seen here: http://2210media.com/test2/xml.php , and Flash is seeing it just like that.

 

Now Flash can not parse unicode so I need PHP to do it for me somehow.

How do I get PHP to convert that to Thai?

 

Thanks,

Josh

Link to comment
Share on other sites

wait.. if you're not wanting to allow html, then you shouldn't use html_entity_decode() as it will turn all of the html back into working html.

It won't just display the thai, it will also allow people to use other things such as

<b> and <i>

 

Not sure if there's a way round this though..

Link to comment
Share on other sites

wait.. if you're not wanting to allow html, then you shouldn't use html_entity_decode() as it will turn all of the html back into working html.

It won't just display the thai, it will also allow people to use other things such as

<b> and <i>

 

Not sure if there's a way round this though..

 

Umm, I think you got it right the first time? I don't want the user to be able to add tags.  ???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.