逃脱了单一角色的介绍人,而不是实际角色
Escaped single character introducer instead of actual character
由于某种原因''u009a被发送到xmlhttp.responseText,而不是''u0161,我不知道为什么。我希望š显示在文本框中,但相反,发送的是单字符介绍人。你知道我该怎么解决这个问题吗?
主页代码:
function loadDoc()
{
var xmlhttp;
// code for IE7+, Firefox, Chrome, Opera, Safari
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
// code for IE6, IE5
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
alert(xmlhttp.responseText);
var a = JSON.parse(xmlhttp.responseText);
document.getElementById("textbox").value=a.first;
document.getElementById("textbox2").value=a.second;
document.getElementById("textbox3").value=a.third;
document.getElementById("textbox4").value=a.fourth;
document.getElementById("textbox5").value=a.fifth;
document.getElementById("textbox6").value=a.sixth;
}
}
xmlhttp.open("GET","loadTextBox.php?id=4",true);
xmlhttp.send();
}
loadTextBox.php代码:
<?php
header("Content-type: application/json");
---Placeholder for correct DB login info---
$result = $mysql->query(---Placeholder for correct SQL query---);
while ($row = $result->fetch_object())
{
$queryResult[] = $row->present_tense;
}
$textboxValue = $queryResult[0];
$textboxValue2 = $queryResult[1];
$textboxValue3 = $queryResult[2];
$textboxValue4 = $queryResult[3];
$textboxValue5 = $queryResult[4];
$textboxValue6 = $queryResult[5];
echo json_encode(array('first'=>utf8_encode($textboxValue),'second'=>
utf8_encode($textboxValue2),'third'=>utf8_encode($textboxValue3),'fourth'=>
utf8_encode($textboxValue4),'fifth'=>utf8_encode($textboxValue5),'sixth'=>
utf8_encode($textboxValue6)));
?>
在行$mysql->query中添加("SET CHARACTER SET'utf8'");在loadTextBox.php中,在连接到DB之后,在SQL查询之前,并使用utf8_encode删除行修复了它。
相关文章:
- 逃脱了单一角色的介绍人,而不是实际角色
- WebMethod在ASP.Net Web角色(Web窗体)中不起作用
- 我应该如何应用if-else条件来向具有不同用户角色的人显示不同的菜单
- 显示使用jquery mobile扫描数据角色=页面上的条形码
- AngularJs基于角色的菜单显示安全问题
- 活动在magento中记录用户角色和权限
- 检查用户是否具有角色分析云代码
- 流星用户帐户和alanning流星角色-登录时检查角色
- 带有alanning的Flowrouter:角色-延迟在'userIsInRole'方法
- Javascript角色处理
- 与Django和Python相比,Node.js在JavaScript和Express之间的MEAN堆栈中扮演什么角色
- HapiJS中基于角色的身份验证
- 角色扮演游戏,如何滑动世界(场景)
- 如何在 JavaScript 中按箭头键来阻止移动角色时屏幕闪烁
- 在加载状态之前,我需要在angular js中为每个状态添加角色
- 如何摆脱角色移动时绘制的图像痕迹
- Angular JS授权-在加载页面之前检查用户角色
- 在D2L主题中按角色发布内容
- 在客户端应用程序中按角色筛选UI的策略
- 对象文字数据表中的 Google 可视化样式角色