zproxy
zproxy

Reputation: 3549

How to set Google App Engine java Content-Type to UTF-8

It seems I cannot get UTF-8 encoding to be sent in the response headers. I tried using this to no avail:

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

Does anyone know when is this bug to be fixed or is there a workaround?

References:

Upvotes: 6

Views: 5703

Answers (2)

Mohamed Ali Ben Thaier
Mohamed Ali Ben Thaier

Reputation: 180

I added this line to the top of my jsp page (that contained the form) and the error is gone

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

Upvotes: 0

Alex Martelli
Alex Martelli

Reputation: 882103

Per the w3 reference, Content-Encoding is for such things as gzip, deflate, compress -- not for "how is Unicode encoded in the body". What you need is e.g.

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

i.e., the charset attribute of Content-Type.

Upvotes: 7

Related Questions