10 Duke Stars available
This topic has
1
reply
on
1
page.
LinkWS
Posts:11
Registered: 2/17/09
Hello,
Please, I am desperated because everything I do about it doesn´t work. Locally I get, but not on the web (linux/cpanel).
What I would like is to set everything used on JSP to UTF-8.
I tried server.xml:
URIEncoding="utf-8"
... web.xml:
<init-param>
<param-name>javaEncoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
...on java start up:
-Dfile.encoding=UTF8
...inside the own jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
%>
...but nothing works. The JSP insists in working on reading request.getParameter() just if was encoded with ISO-8859-1.
Please, give me some light. Thanks.
Thanks.
Edited by: LinkWS on Sep 28, 2009 5:40 AM
Edited by: LinkWS on Sep 28, 2009 5:41 AM
Your JSP container is defaulting to ISO-8859 but your parameters are UTF-8 encoded.
You can work around your container with this code:
String value = new String(getParameter("param").getBytes("ISO-8859-1"), "UTF-8");
If you are using Tomcat, add the Connector attribute in server.xml, URIEncoding="UTF-8", otherwise Tomcat will assume ISO-8859 encoding to your parameters.
HTH,
Eugenio
This topic has
1
reply
on
1
page.
Back to Forum
Read the Developer Forums Code of Conduct
Email this Topic
Edit this Topic
Site Upgrade
Forums 7.1.8 was deployed Oct 26th. The release consists of minor fixes & a few enhancements.
Forums Statistics
Users Online : 54 Guests : 135
About Sun forums
Sun Forums is a large collection of user generated
discussions. It is here to help you ask questions, find answers, and
participate in discussions.
Check out our guide on Getting
started with Sun Forums for a full walkthrough of how to best
leverage the benefits of this community.