- Ensure that your .jsp file is really written with the expected encoding
- In the servlet that dispatch to the jsp use
request.setCharacterEncoding("ISO-8859-9");
- Try to put a tag with a purely ISO-8859-9 character inside.
Encoding issue in jsp page
-
29-06-2022 - |
Question
I have a problem about character encoding
in jsp pages
. Even if i added charset params
to my page, i still have this problem. when I statically add Turkish chars to my jsp page
it is ok, but the text added to the page dynamically by java has charset problem. And i am using webSphere 6
as app server of my app. This is how i added tags,
<%@ page contentType="text/html;charset=ISO-8859-9" %>
<META http-equiv="Content-Type" content="text/html; charset=windows-1254">
For example the code below read related strings from language txt, and try to print it in jsp. all turkish chars encoded wrong , so that is why they appears wrong.
<h2><%=Messages.message("metin1")%>
Solution
OTHER TIPS
Save the jsp file with utf encoding. Also use
request.setCharacterEncoding("UTF-8");
in servlet.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow