使用 JAX RS 在 Google App Engine 中设置 UTF-8
传递诸如 ÅäÖ 之类的值将被转换为 ???到达服务器时。
JQuery ajax call is as follows:
$.ajax({
url: 'some url here',
type: 'post',
contentType:"application/xml;charset=utf-8",
scriptCharset: "utf-8" ,
data: 'some data here',
success: function(data, status) {
//code...
}
});
添加
<env-variables>
<env-var name="DEFAULT_ENCODING" value="UTF-8" />
</env-variables>
到 appengine-web.xml
它适用于本地系统,但不适用于 GAE。
Passing values such as ÅÄÖ is getting converted to ??? on reaching the server.
JQuery ajax call is as follows:
$.ajax({
url: 'some url here',
type: 'post',
contentType:"application/xml;charset=utf-8",
scriptCharset: "utf-8" ,
data: 'some data here',
success: function(data, status) {
//code...
}
});
Added
<env-variables>
<env-var name="DEFAULT_ENCODING" value="UTF-8" />
</env-variables>
in appengine-web.xml
It works in local system but doesn't work on GAE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用解决了它
msg = new String(msg.getBytes("UTF8"), "UTF8");
Solved it using
msg = new String(msg.getBytes("UTF8"), "UTF8");