PHP General,
The Situation:
I am creating a form for users to enter text into a MySQL 3.23 database. The text is often in Japanese, encoded in utf-8 format.
The Problem:
When the utf-8 encoded text is inserted into the database, it becomes random ASCII gibberish.
What I've Tried So Far:
I've noticed that it is possible to save utf-8 encoded text in the database. When I insert Japanese text into the database using phpMyAdmin, it stores okay, and I can access the text via PHP for placement on web pages. So my speculation is that there is something wrong with my script.
My search on the web for information has turned up indication that it should be possible to simply store utf-8 text without the need for modifications. Some places suggest that it might be best to store the Japanese text as binary. But since I can enter utf-8 text into fields and store them as text successfully in phpMyAdmin, I am sure there must be a way for getting around binary storage. I'd like to avoid binary storage if possible, for a variety of reasons.
The Question:
How can I preserve the text so that it does not become garbled when written to the database?
For Reference:
Here is the form and the PHP script that it accesses. $showData is obtained by querying the database and seeing what is already stored there.
<form enctype="multipart/form-data" action="" method="POST">
<p>English (256 characters)</p>
<p><textarea name="introE" rows="5" cols="50"><?php echo $showData['introE'];?></textarea></p>
<p>(Japanese)(256 Characters)</p>
<p><textarea name="introJ" rows="5" cols="50"><?php echo $showData['introJ'];?></textarea></p>
<p><input type="submit" name="submit" value="submit" /></p>
<?php
if (isset ($HTTP_POST_VARS['introE']) || isset ($HTTP_POST_VARS['introJ']))
{
$updateQuery = "UPDATE events SET introE='" . $HTTP_POST_VARS['introE'] . "', introJ='" . $HTTP_POST_VARS['introJ'] . "' WHERE eventid = " . $show;
$updateResult = mysql_query($updateQuery);
}
?>
</form>
Any help much appreciated.
-- Dave Gutteridge [EMAIL PROTECTED] Tokyo Comedy Store http://www.tokyocomedy.com/english/
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php