我想插入/讀阿拉伯語詞彙進入mysql數據庫插入阿拉伯語詞彙進入mysql數據庫
當我從Chrome中插入阿拉伯語詞彙,我看到他們在DB ASCII
當我從Firefox插入,我看到他們在DB的Unicode
見從我的DB這樣的畫面:http://postimg.org/image/6ht95v671/
我需要在ASCII中插入一切只
注:我從PHP的形式使用POST方法
只能插入我想插入/讀阿拉伯語詞彙進入mysql數據庫插入阿拉伯語詞彙進入mysql數據庫
當我從Chrome中插入阿拉伯語詞彙,我看到他們在DB ASCII
當我從Firefox插入,我看到他們在DB的Unicode
見從我的DB這樣的畫面:http://postimg.org/image/6ht95v671/
我需要在ASCII中插入一切只
注:我從PHP的形式使用POST方法
只能插入圖表你總是可以將其轉換爲十六進制,把它在數據庫
function strToHex($string){
$hex='';
for ($i=0; $i < strlen($string); $i++){
$hex .= dechex(ord($string[$i]));
}
return $hex;
}
前再由十六進制轉換爲字符串獲取值
function hexToStr($hex){
$string='';
for ($i=0; $i < strlen($hex)-1; $i+=2){
$string .= chr(hexdec($hex[$i].$hex[$i+1]));
}
return $string;
}
http://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Mihai
解決編程問題需要編碼。 – Mihai
我發現問題從瀏覽器編碼不是從utf8 lol – Ahmed