Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
My mysql is storing data in UTF-8 and have alot of data in Korea and Japan. I used mb_convert_encoding() to convert UTF-8 to EUC-KR(Korea) or Shift-JIS(Japan) to display the webpage. The problem is when I try to query using EUC-KR(Korea) or Shift-JIS(Japan) as keyword, mostly it will work but sometime didn't. Well I did use the mb_convert_encoding() to convert the EUC-KR(Korea) or Shift-JIS(Japan) back to UTF-8 before I try to query.
Any one know what is the reason?
The keywords I used to search that is not working:
EUC-KR= "디너" or "대쉬"
Shift-JIS= "ダブ"
Keywords which is working:
EUC-KR= "큐클럽"
Shift-JIS="ブロック"
Here are the part of the php code:
[index.php]Code: Select all
<form name="formSearchbyword" action="do_search.php" method="post">
<tr><td align="left">
<input type="text" name="strSearch">
</td>
<td align="right">
<input type="image" src="<?=$imagepath.$_btnSearch?>">
</td></tr>
</form>Code: Select all
function Query($requete) {
$result = mysql_db_query(DB_NAME, $requete);
if (!$this->canNotDie and !$result) { die(mysql_error()); }
if ($this->canNotDie and !$result) {
$this->strSqlError = mysql_error();
$this->intSqlError = mysql_errno();
return false;
}
mysql_free_result($result);
return $array_result;
}
//$strSearch=디너 over here
$isTranslated= mb_convert_encoding($strSearch, "UTF-8", "EUC-KR");
$sql_query = "SELECT name FROM personal where name like '%$isTranslated%' ";
$res = Query($sql_query);
echo $res["name"];feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]