錯誤 GMap2未定義 解決辦法 (關鍵在於:charset="utf-8" )
<script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAnzgK6D9hdvlLyVMROdMgRxRvkvyC2uHS-ibWMJG7xp28q6sn4RSCVBqVh-Kb2lwBiDjnbXc4A9U_XQ" type="text/javascript" charset="utf-8"></script>
''/////************************* VB 中文轉為UNICODE字元
''//中文轉為UNICODE字元
''Dim str As String = "新景花園"
''Dim outStr As String = ""
''Dim i As Integer = 0
''For i = 1 To str.Length
'' outStr = outStr + "\u" + Hex(AscW(Mid(str, i, 1))).ToString()
''Next i
代碼
context.Response.ContentType = "application/json";
context.Response.Charset = "utf-8";
string txt = "{\"50697\":[\"\u65b0\u666f\u5bb6\u56ed\",392,39.8957115,116.4256382]}";
context.Response.Write(txt);
//Response.Write("\u65b0\u666f\u5bb6\u56ed" + "<br>");
//Response.Charset = "utf-8";
//string str = "動網新聞";
//string outStr = "";
//if (!string.IsNullOrEmpty(str))
//{
// for (int i = 0; i < str.Length; i++)
// {
// //將中文字元轉為10進位整數,然後轉為16進位unicode字元
// outStr += "\\u" + ((int)str[i]).ToString("x");
// }
//}
//Response.Write(outStr);
//Response.End();
//////中文轉為UNICODE字元
////string str = "中文";
////string outStr = "";
////if (!string.IsNullOrEmpty(str))
////{
//// for (int i = 0; i < str.Length; i++)
//// {
//// //將中文字元轉為10進位整數,然後轉為16進位unicode字元
//// outStr += "\\u" + ((int)str[i]).ToString("x");
//// }
////}
//////UNICODE字元轉為中文
////string str = "\\u4e2d\\u6587";
////string outStr = "";
////if (!string.IsNullOrEmpty(str))
////{
//// string[] strlist = str.Replace("\\", "").Split('u');
//// try
//// {
//// for (int i = 1; i < strlist.Length; i++)
//// {
//// //將unicode字元轉為10進位整數,然後轉為char中文字元
//// outStr += (char)int.Parse(strlist[i], System.Globalization.NumberStyles.HexNumber);
//// }
//// }
//// catch (FormatException ex)
//// {
//// outStr = ex.Message;
//// }
////}
仿安居客地圖
/Files/Fooo/haozuMap.rar