struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qunhuan Mei (JIRA)" <j...@apache.org>
Subject [jira] Commented: (WW-3119) Stringlength validation problem for utf-8 chars (Struts 2.1.6)
Date Thu, 17 Jun 2010 20:14:26 GMT

    [ https://issues.apache.org/jira/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879911#action_12879911
] 

Qunhuan Mei commented on WW-3119:
---------------------------------

yes, fortunately! :-)


Hi Xiao Dai (may be last time to call you Xiao ... :-)  ) and CongLin,

Thanks for your contacts. I am still in London, live a very quiet life with
my wife and daughter.

Do think of you very often. Shame no marvelous things to share with you.

你们都好吧?!又相当长时间没联系了。很想念你们!我的家用电邮地址已改成qunhuan.mei@gmail.com

小戴还在美国,丛林还在上海吗?欢迎来伦敦玩!代问小林好!

方建平在我的视野里失踪了,还有顾严勤。

再见,

群欢


> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
>                 Key: WW-3119
>                 URL: https://issues.apache.org/jira/browse/WW-3119
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.1.6
>         Environment: Win XP, Eclipes, Tomcat
>            Reporter: Qunhuan Mei
>            Assignee: Wes Wannemacher
>            Priority: Critical
>             Fix For: 2.1.8
>
>
> When I try to validate utf-8 chars such as Chinese using Struts 2.1.6, the stringlength
validation appears to have problem. It seems the validation process is not using the number
of Chinese chars before encoding, but rather the number of chars after encoding. The following
are the steps to reproduce the problem:
> 1.	Create a project by importing struts2-blank-2.1.6.war from ...\struts-2.1.6\apps"

> and make the login.jsp work with Login.java, e.g. print out the username.length() in
setUsername(...) function.
> 2.	copy the following stringlength validation code into Login-validation.xml:
> <field-validator type="stringlength">
>         	<param name="maxLength">4</param>
>         	<param name="trim">true</param>
>         	<message key="fieldNameShouldBeWithinMaxLength"/>        	
> </field-validator>
> 3.	copy the following stringlength error message into package.properties:
> fieldNameShouldBeWithinMaxLength=The max number of chars of ${getText(fieldName)} is
${getText(maxLength)}
> 4.	run the login.jsp and type in either "abcd" and "abcde" into username, we can see
that "abcd" does not incur a validation message whereas "abcde" does.
> 5.	now typing 2 Chinese chars, say "世界"into the user name, which should not have
any problem since only 2 chars. However the struts reports the chars received are more than
4. As a matter of fact, the print out statement in setUsername(...) reports the number of
chars is 6.
> Qunhuan Mei
> BTW: is there any way to access the validation code from struts 2.1.7 (this bug may have
been fixed by the 2.1.7 code)? Thanks.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message