如何将Google App Engine的Java Content-Type设置为UTF-8

时间:2009-06-06 19:14:44

标签: java google-app-engine utf-8

似乎我无法在响应头中发送UTF-8编码。 我尝试使用它无济于事:

resp.setHeader("Content-Encoding", "utf-8");

有谁知道这个错误何时修复或有解决方法

参考文献:

2 个答案:

答案 0 :(得分:7)

the w3 referenceContent-Encoding用于gzip,deflate,compress - 而不是,用于“如何在体内编码Unicode”。你需要的是例如。

Content-Type: text/html; charset=utf-8

charset的{​​{1}}属性。

答案 1 :(得分:0)

我将此行添加到我的jsp页面顶部(包含表单)并且错误消失了

<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>