中文在js的傳輸問題
中文to utf
<script type ="text/javascript" ><!--
function mm(str)
{
var sw = document.getElementById("show");
if(str==""){sw.value=""; return; }
var a = str.split(""); //author: meizz
for(var i=0; i<a.length; i++)
{
if(/[\u4e00-\u9fa5\uf900-\ufa2d\uFE30-\uFFA0]/.test(a[i]))
{
a[i] = "\\u"+ a[i].charCodeAt(0).toString(16);
}
}
sw.value = a.join("");
}
//--></script>
cun chinese or eng num
For i = 0 To Int(show.Value.Trim.Length / 6) - 1
Dim c As Char = Convert.ChangeType(Convert.ToInt32(show.Value.Trim.Substring(2 + 6 * i, 4), 16), TypeCode.Char)
Me.Label1.Text += New String(c, 1)
Next
If Me.Label1.Text.Trim = "" Then
Me.Label1.Text = Me.show.Value.Trim
End If