You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Padma Ginnaram <pa...@s1.com> on 2002/10/18 15:46:15 UTC

RE: [Struts Validator / i18N] accentuated letters with \w patter n dont work

from regexp javadoc at http://jakarta.apache.org/regexp/apidocs/ 
	 \w                   Matches a "word" character (alphanumeric plus
"_")

You probably need letters of latin-1 supplement (U+00C0 - U+00FF), refer to
http://www.unicode.org/charts/ for more details.

specify this range of characters in your mask pattern and the validator
should work. This worked for me for chinese characters with an older version
of the validator framework which use jakarta regexp.
		    <var>
                  <var-name>mask</var-name>
                  <var-value>^[a-zA-Z\u00C0-\u00FF]*$</var-value>
                </var>

-Padma

-----Original Message-----
From: Vincent PROSPER [mailto:Vincent.Prosper@Alkinos.com]
Sent: Friday, October 18, 2002 4:44 AM
To: struts-user@jakarta.apache.org
Subject: [Struts Validator / i18N] accentuated letters with \w pattern
dont work


Hi,

In my validation.xml file, I have the following formset tag:

<global>
  <constant>
   <constant-name>name</constant-name>
   <constant-value>^[\w|-|'| ]+$</constant-value>
  </constant>
 ...
</global>

<formset language="fr">
	<form name="subscribeForm">
	  <field property="lastName" depends="required,mask">
         <arg0 key="subscribe.field.lastName"/>
         <var>
           <var-name>mask</var-name>
           <var-value>${name}</var-value>
         </var>
        </field>
        ...
	</form>
</formset>

All works fine, except for accentuated letters which aren't matched by the
regexp ${name}... That is to say, "Rene" works but "René" doesn't!

Could you please help me on this topic?
NB: <html:html locale="true"> is also set in the JSP.

Another question, that has nothing to do with the previous one, except it
also concerns Struts Validator:

How can I remove the <h3>Error</h3><ul>...</ul><hr/> that is generated by
Struts Validator when replacing <html:errors/>? I put error messages besides
each field with a <html:errors property="myField"/>, and it displays that
ugly HTML stuff instead of a simple error message (and also without taking
into account my CSS class...)

Thanks in advance for both answers.

Vince



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: [Struts Validator / i18N] accentuated letters with \w pattern dont work

Posted by Vincent PROSPER <Vi...@Alkinos.com>.
Padma,

Thanks a lot for your answer. It obviously works...
My first thought was when setting the right locale, \w should match any
accentuated letter (as it works in Perl), but your trick is more accurate
and OK for me.

Have a nice day.

Vince


-----Original Message-----
From: Padma Ginnaram [mailto:padma.ginnaram@s1.com]
Sent: Friday, October 18, 2002 3:46 PM
To: 'Struts Users Mailing List'
Subject: RE: [Struts Validator / i18N] accentuated letters with \w
pattern dont work



from regexp javadoc at http://jakarta.apache.org/regexp/apidocs/
	 \w                   Matches a "word" character (alphanumeric plus
"_")

You probably need letters of latin-1 supplement (U+00C0 - U+00FF), refer to
http://www.unicode.org/charts/ for more details.

specify this range of characters in your mask pattern and the validator
should work. This worked for me for chinese characters with an older version
of the validator framework which use jakarta regexp.
		    <var>
                  <var-name>mask</var-name>
                  <var-value>^[a-zA-Z\u00C0-\u00FF]*$</var-value>
                </var>

-Padma

-----Original Message-----
From: Vincent PROSPER [mailto:Vincent.Prosper@Alkinos.com]
Sent: Friday, October 18, 2002 4:44 AM
To: struts-user@jakarta.apache.org
Subject: [Struts Validator / i18N] accentuated letters with \w pattern
dont work


Hi,

In my validation.xml file, I have the following formset tag:

<global>
  <constant>
   <constant-name>name</constant-name>
   <constant-value>^[\w|-|'| ]+$</constant-value>
  </constant>
 ...
</global>

<formset language="fr">
	<form name="subscribeForm">
	  <field property="lastName" depends="required,mask">
         <arg0 key="subscribe.field.lastName"/>
         <var>
           <var-name>mask</var-name>
           <var-value>${name}</var-value>
         </var>
        </field>
        ...
	</form>
</formset>

All works fine, except for accentuated letters which aren't matched by the
regexp ${name}... That is to say, "Rene" works but "René" doesn't!

Could you please help me on this topic?
NB: <html:html locale="true"> is also set in the JSP.

Another question, that has nothing to do with the previous one, except it
also concerns Struts Validator:

How can I remove the <h3>Error</h3><ul>...</ul><hr/> that is generated by
Struts Validator when replacing <html:errors/>? I put error messages besides
each field with a <html:errors property="myField"/>, and it displays that
ugly HTML stuff instead of a simple error message (and also without taking
into account my CSS class...)

Thanks in advance for both answers.

Vince



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>