From issues-return-13132-apmail-struts-issues-archive=struts.apache.org@struts.apache.org Thu May 07 05:27:53 2009 Return-Path: Delivered-To: apmail-struts-issues-archive@minotaur.apache.org Received: (qmail 31633 invoked from network); 7 May 2009 05:27:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 May 2009 05:27:53 -0000 Received: (qmail 11288 invoked by uid 500); 7 May 2009 05:27:52 -0000 Delivered-To: apmail-struts-issues-archive@struts.apache.org Received: (qmail 11223 invoked by uid 500); 7 May 2009 05:27:52 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 11215 invoked by uid 99); 7 May 2009 05:27:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 05:27:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 May 2009 05:27:50 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BF6DB29A0011 for ; Wed, 6 May 2009 22:27:30 -0700 (PDT) Message-ID: <1500503626.1241674050778.JavaMail.jira@brutus> Date: Wed, 6 May 2009 22:27:30 -0700 (PDT) From: "Qunhuan Mei (JIRA)" To: issues@struts.apache.org Subject: [jira] Work stopped: (WW-3119) Stringlength validation problem for utf-8 chars (Struts 2.1.6) In-Reply-To: <1750545163.1241628631588.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 2265bf7ad70cb93affdfde3e15287371 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/struts/browse/WW-3119?page=3Dcom.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, th= e stringlength validation appears to have problem. It seems the validation = process is not using the number of Chinese chars before encoding, but rathe= r the number of chars after encoding. The following are the steps to reprod= uce the problem: > 1.=09Create a project by importing struts2-blank-2.1.6.war from ...\strut= s-2.1.6\apps"=20 > and make the login.jsp work with Login.java, e.g. print out the username.= length() in setUsername(...) function. > 2.=09copy the following stringlength validation code into Login-validatio= n.xml: > > =094 > =09true > =09 =09 > > 3.=09copy the following stringlength error message into package.propertie= s: > fieldNameShouldBeWithinMaxLength=3DThe max number of chars of ${getText(f= ieldName)} is ${getText(maxLength)} > 4.=09run the login.jsp and type in either "abcd" and "abcde" into usernam= e, we can see that "abcd" does not incur a validation message whereas "abcd= e" does. > 5.=09now typing 2 Chinese chars, say "=E4=B8=96=E7=95=8C"into the user na= me, which should not have any problem since only 2 chars. However the strut= s reports the chars received are more than 4. As a matter of fact, the prin= t 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 (th= is bug may have been fixed by the 2.1.7 code)? Thanks. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.