如何将Google App Engine的Java Content-Type设置为UTF-8
似乎我无法在响应头中发送UTF-8编码。 我试过用这个无济于事:
resp.setHeader("Content-Encoding", "utf-8");
有谁知道这个bug什么时候修复或有解决方法 ?
参考文献:
- http://groups.google.com/group/google-appengine/browse_thread/thread/68a480cb7bec869e
- http://www.ozelwebtasarim.com/index.php/google/10004-google-app-engine-java-utf-8-character-encoding-problem
根据w3参考 , Content-Encoding
用于诸如gzip,deflate,compress之类的东西 – 而不是 “如何在体内编码Unicode”。 你需要的是例如
Content-Type: text/html; charset=utf-8
即, Content-Type
的charset
属性。
我将此行添加到我的jsp页面顶部(包含表单),错误消失了
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>