mtyurt
mtyurt

Reputation: 3449

Character Encoding - RequestDispatcher

I have a servlet and I use

String error = "error";
request.setAttribute("loginError", error);
request.setCharacterEncoding("UTF-8");
request.getRequestDispatcher("/index.jsp").forward(request, response);

and I use

<%@ page language="java" contentType="text/html; charset=ISO-8859-9"
pageEncoding="ISO-8859-9"%>

in my jsp page, also

request.setCharacterEncoding("UTF-8");

But if I forward a page, this pages' encoding does not work. How can I handle this encoding? Thanks.

Upvotes: 2

Views: 2128

Answers (1)

Reto Mayer
Reto Mayer

Reputation: 55

I had the same problem and i found your unanswered question. I solved it with adding

response.setContentType("text/html;charset=UTF-8");

Upvotes: 2

Related Questions