我想存储印度语言并再次显示保存的消息。(带有语言消息的 CRUD 操作)。我能够实现创建,但是尝试阅读时我得到“???” 而不是已保存的语言内容(即 नमस्ते )。因此,当我调试时,我会找到数据,直到打印编写器对象如预期的那样以语言显示。但是当我在 JavaScript 上接收我的 Ajax 时。我得到“????”。
注意:
我尝试了 content-type - text/html、application/json。
编码为 UTF-8
在服务器:
response.setCharacterEncoding("UTF-8");
response.setContentType("text/plain;charset=UTF-8");
response.setHeader("Cache-Control", "private, no-store, no-cache, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.setHeader("x-xss-protection", "1; mode=block");
response.setHeader("x-frame-options", "SAMEORIGIN");
out = response.getOutputStream();
out.write("नमस्ते");// this is coming from db
在客户
$.get({
url: "/server/langMsg",
}).then(function(rspTxt){
var json = $.parseJSON(rspTxt);
});
慕哥9229398
白衣非少年
相关分类