You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Qunhuan Mei (JIRA)" <ji...@apache.org> on 2009/05/06 18:50:31 UTC
[jira] Created: (WW-3119) Stringlength validation problem for utf-8
chars (Struts 2.1.6)
Stringlength validation problem for utf-8 chars (Struts 2.1.6)
--------------------------------------------------------------
Key: WW-3119
URL: https://issues.apache.org/struts/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
Priority: Critical
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.
[jira] Work started: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on WW-3119 started by Qunhuan Mei.
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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: Qunhuan Mei
> Priority: Critical
>
> 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.
[jira] Work stopped: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on WW-3119 stopped by Qunhuan Mei.
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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: Qunhuan Mei
> Priority: Critical
>
> 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.
[jira] Work started: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on WW-3119 started by Qunhuan Mei.
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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: Qunhuan Mei
> Priority: Critical
>
> 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.
[jira] Updated: (WW-3119) Stringlength validation problem for utf-8
chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Qunhuan Mei updated WW-3119:
----------------------------
Tested fixed in 2.1.7
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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: Qunhuan Mei
> Priority: Critical
>
> 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.
[jira] Closed: (WW-3119) Stringlength validation problem for utf-8
chars (Struts 2.1.6)
Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wes Wannemacher closed WW-3119.
-------------------------------
Resolution: Fixed
Fix Version/s: 2.1.7
Assignee: Wes Wannemacher (was: Qunhuan Mei)
fix already implemented
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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.7
>
>
> 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.
[jira] Work stopped: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Work on WW-3119 stopped by Qunhuan Mei.
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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: Qunhuan Mei
> Priority: Critical
>
> 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.
[jira] Commented: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46181#action_46181 ]
Wes Wannemacher commented on WW-3119:
-------------------------------------
Qunhuan Mei,
In fact, you can access the struts 2.1.7 snapshot code here -
http://people.apache.org/builds/struts/nightlies/2.x/
If you don't mind testing this with the snapshots at the above URL, that would be great.
-Wes
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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
> Priority: Critical
>
> 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.
[jira] Commented: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46182#action_46182 ]
Qunhuan Mei commented on WW-3119:
---------------------------------
Thanks Wes,
I have tested it using 2.1.7 and the problem has already been solved. HURRAY!
Qunhuan
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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
> Priority: Critical
>
> 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.
[jira] Assigned: (WW-3119) Stringlength validation problem for
utf-8 chars (Struts 2.1.6)
Posted by "Qunhuan Mei (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/struts/browse/WW-3119?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Qunhuan Mei reassigned WW-3119:
-------------------------------
Assignee: Qunhuan Mei
> Stringlength validation problem for utf-8 chars (Struts 2.1.6)
> --------------------------------------------------------------
>
> Key: WW-3119
> URL: https://issues.apache.org/struts/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: Qunhuan Mei
> Priority: Critical
>
> 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.