File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regular expression validation problem

 
Mikael Gyth
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17616
38
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic