It's not a secret anymore!*
The moose likes Struts and the fly likes Struts 1 Chinese Character Entry Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1 Chinese Character Entry" Watch "Struts 1 Chinese Character Entry" New topic
Author

Struts 1 Chinese Character Entry

stephen r munro
Greenhorn

Joined: Apr 26, 2013
Posts: 1
Hello,

I'm having problems enhancing an extremely old legacy application that was developed using struts 1.2.9 and tiles. Essentially, the application is to support the Chinese language and some of the pages must allow for Chinese character entry. When I enter Chinese characters into the text box, the page refreshes and the text box contains unrecognized characters. I have set the encoding of the JSP/Servlets to UTF-8 and explicitly set the HttpServletRequest/HttpServletResponse content type to utf-8. All the display text is successfully is successfully showing Chinese characters, so the correct resource bundle is being applied. However, posting forms with Chinese characters completely fails.

What I've tried:

1. Added <%@ page contentType="text/html; charset=UTF-8" %> <%@ page pageEncoding="UTF-8" %> to all JSPs
2. In struts-config.xml, I've defined <controller processorClass="org.desolate.RequestProcessor"/>with methods that set the request/response character encoding to UTF-8.
3. Invoked Charset.defaultCharset() in the debugger and it shows that UTF-8 is the default.
4. updated the server.xml connector definitions to use URIEncoding="UTF-8"

So, the problem seems to be specific to posting text field data. The input is chinese text, but when the page is refreshed, unrecognised characters are shown...


As mentioned, I am using struts 1.2.9 and tiles, which is deployed on springsource vmfrabic TCServer (tomcat 7 config), using Java 7.

can anyone suggest things to try, I must be missing something very fundamental?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 1 Chinese Character Entry
 
Similar Threads
Problem with UTF-8 Character encoding
Multilingual JSP Problem
How to force encoding of web browser to UTF-8
multiple language support in one XML
Some (not all!) UTF8 Characters render as "?" only from UNIX server -- works perfectly local (Win)..