freestar
freestar

Reputation: 448

java / Servlets / ISO-8859-1 instead of UTF-8

I have set character encoding of the response to UTF-8 by

response.setCharacterEncoding("UTF-8");

Despite that, on the client-side, several characters are broken. I had a look at the response's header in the browser tool, and i found out that the encoding was set to ISO-8859-1.

How can i solve this issue? What is the underlying problem?

Upvotes: 3

Views: 1656

Answers (1)

freestar
freestar

Reputation: 448

I have found the problem:

response.setCharacterEncoding("UTF-8"); must be declared before response.getWriter();

Upvotes: 5

Related Questions