s:commonsValidator:display error message in chinese(or other multi-bytes 
language) in javascript
------------------------------------------------------------------------------------------------

                 Key: SHALE-314
                 URL: http://issues.apache.org/struts/browse/SHALE-314
             Project: Shale
          Issue Type: Improvement
    Affects Versions: 1.0.3, 1.0.4-SNAPSHOT
         Environment: any
            Reporter: jialing


<s:commonsValidator type="required"
                             arg="#{msgs.creditCardNumberPrompt}"
                          server="true"
                          client="true"/>
if msgs.creditCardNumberPrompt contains chinese characters, 
the javascript generated contains such "#&xxxxx;&#xxxxx;", but should be 
"\uXXXX\uXXXX".

eg:
alert("&#20013;&#22269;");
//will display [&#20013;&#22269;] not the actual chars
//the correct statement is
alert("\u4E2D\u56FD");

otherwise you should write following script to solve the problem

<script>
window._alert=window.alert; 
window.alert=function(s) { 
_alert(s.replace(/&#(\d{5});/g,function(r,r1) {return 
String.fromCharCode(r1);})); 
}; 
//alert("&#20013;&#22269;");
</script>





-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to