[
https://issues.apache.org/struts/browse/WW-3032?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Musachy Barroso resolved WW-3032.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.1.7
the JSON validation interceptor nows set the response encoding to UTF-8 which
makes this work properly (tested in Showcase). Thanks for reporting.
> jsonValidationWorkflowStack bug? --- Struts 2 Ajax validation Unicode
> messages (e.g. for Japanese, Chinese) all displayed as "?"
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: WW-3032
> URL: https://issues.apache.org/struts/browse/WW-3032
> Project: Struts 2
> Issue Type: Bug
> Components: XML Validators
> Affects Versions: 2.1.6
> Environment: windows xp pro, eclipse 3.4.1, java 1.6.
> Reporter: Qunhuan Mei
> Priority: Critical
> Fix For: 2.1.7
>
>
> Hi,
> I am reporting this problem hoping someone with more knowledge could confirm
> whether it is a bug or just a setting issue.
> I am going to use Struts-blank-2.1.6 with eclipse to demonstrate the problem
> that when using Struts 2 Ajax validation procedure and all validation
> messages in Unicode (e.g. for Japanese, Chinese) will be displayed as "?".
> Full steps listed below:
> 1. Create a project by importing struts2-blank-2.1.6.war from
> ...\struts-2.1.6\apps"
> 2. Copy the form code from Login.jsp into Welcome.jsp, right before </body>
> tag:
> <s:form action="Login">
> <s:textfield key="username" />
> <s:password key="password" />
> <s:submit/>
> </s:form>
> So that we could validation on username and password input fields on welcome
> page.
> At this point, build the project and run welcome.jsp "on the server", we can
> see validation works fine (e.g. click submit without any input will receive
> right error reporting page back). Here the validation messages are not utf-8
> based.
> 3. Prepare some utf-8 encoded validation message using Google translator. Say
> translate "register" into Japanese and Chinese. Then using command
> "native2ascii -encoding utf-8" to turn these two internationalised message
> into unicode, we get: \u767b\u9332 and \u6ce8\u518c
> Simply copy the unicode message into the end of each line of project's
> package.properties so that we can see whether these messages are displaced
> correctly (within my eclipse, the packge.properties file are encoded in
> utf-8).
> 4. Build the project and run welcome.jsp again, we can see the Unicode
> message are displayed correctly on page. Simply click submit without input
> anything, we also see both Japanese and Chinese are displayed correctly
> (graphically recognizable).
> This indicates without using Ajax, the validation mechanism can handle
> Unicode message correctly.
> 5. Turn the validation into using Ajax (either in dojo or prototype.js way,
> see http://struts.apache.org/2.1.6/docs/ajax-validation.html):
> I am using dojo way:
> (1) Adding dojo taglib to line 3 of Welcome.jsp:
> <%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
> (2) Adding <sx:head /> right after <head> to enable ajax validation on the
> page
> (3) Replace <s:submit> with <sx:submit validate="true"
> ajaxAfterValidation="true" showLoadingText="false"/>
> (4) Adding do-jo jar file "struts2-dojo-plugin-2.1.6.jar" to the project's
> lib (from "...\struts-2.1.6\lib") and refresh the project
> (5) Adding following two lines to example.xml, right below <action
> name="Login_*" method="{1}" class="example.Login">:
>
> <interceptor-ref name="i18n"/>
> <interceptor-ref name="jsonValidationWorkflowStack"/>
> Rebuild the project and run welcome.jsp. Click submit without any input, we
> can see all English error message are displayed correctly, but both Japanese
> and Chinese characters are displayed as question marks ("?").
> Replacing dojo approach with prototype one I get the same result.
> (My working environment: windows xp pro, eclipse 3.4.1, java 1.6.)
> I am suspecting somehow the jsonValidationWorkflowStack is not handling
> unicode well under the circumstances.
> Qunhuan Mei
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.