• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Regular expression validation problem

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.

I'm stuck trying to validate a String field in a entity class.


The regular expression should work, but every time I attempt to insert a word with æ,ø or å, Æ, Ø orÅ in it it fails validation.

Does anyone have any tips or hints on what's wrong?

Br.
 
Mikael Gyth
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Apparantly they aren't getting trough the validation because the server reads them as ÆØÅ characters. I have gone trough all my files and my database to make sure it's all UFT-8. But i'm still getting the same results.
Anyone know if there are any additional charset settings I have to set anywhere?
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think that you may be having issues in using extended character codes in your Pattern. That would be independent of whether you have the other settings correct or not.

There are a couple of possibilities:

1. Specify the pattern characters as Unicode escapes

2. Define the pattern using I18N rules

3. See if your underlying JVM Locale settings can be set to accept these characters as normal letters

4. Write tour own custom string validator
 
Mikael Gyth
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello and thanks for the reply.
These characters have worked before, we had the same problem early in the project but it has come back at some point, and we probably didn't notice it until the validation failed.
I think the most relevant solution would be nr. 3. But as I said earlier I have gone trough all the tables in the database and all the xhtml files and made sure they are all UTF-8, witch to my knowledge should be sufficient to make this work.
Is there anywhere else in the project config files or on the Glassfish server we can set these parameters? we have a Maven web project with JSF and PrimeFaces, also we are using hibernate(eclipselink) for out datasource.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic