AJAX傳遞中文字符串時必須把中文字符串編碼成unicode
function uniencode(text)
{
text = escape(text
var matches = text
if (matches)
{
for (var matchid =
{
var code = matches[matchid]
if (parseInt(code
{
text = text
}
}
}
text = text
return text;
}
當然服務器端要對編碼過的字符串進行第二次轉碼
function convert_int_to_utf
{
$intvalintval = intval($intval)
switch ($intval)
{
//
case
return chr(
case ($intval &
return chr($intval)
//
case ($intval &
return chr(
chr(
//
case ($intval &
return chr(
chr(
chr (
//
case ($intval &
return chr(
chr(
chr(
chr(
}
}
這樣中文字符串就可以轉換成UTF
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25844.html