users@glassfish.java.net

Can not set Character Encoding using sun-web.xml

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 Sep 2009 08:13:54 PDT

I am trying to send € (Euro) character from my JSP page to another JSP page as a form parameter. On when I try retrieve the parameter which I sent, it retrieves that as "?" (Question mark).
After searching on java.net thread I came to know that I should have following entry in my sun-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 8.0 Servlet 2.4//EN" "http://www.sun.com/software/sunone/appserver/dtds/sun-web-app_2_4-0.dtd">

<sun-web-app>
  <locale-charset-info default-locale="nl">
    <locale-charset-map locale="nl" charset="UTF-8"/>
    <parameter-encoding default-charset="UTF-8"/>
  </locale-charset-info>
</sun-web-app>


But it did not work with this approach still the character go as €.
Infact in the servler.log I can see that there are exceptions (warning thrown):
[#|2009-09-10T20:22:54.524+0530|WARNING|sun-appserver9.1|org.apache.coyote.tomcat5.CoyoteRequest|_ThreadID=24;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=56dff407-5f13-4d0e-81e5-47876fdd7323;|PWC4011: Unable to set request character encoding to UTF-8 from context /BJN33QA, because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

All I need is I should be able to send UTF-8 compatible character as part of my request parameters (either through URL query string or through form data).
[Message sent by forum member 'npbirajdar' (npbirajdar_at_yahoo.com)]

http://forums.java.net/jive/thread.jspa?messageID=363518