Struts - validating foreign characters

Discussion in 'Java' started by mdjj, Mar 31, 2006.

  1. mdjj

    mdjj Guest

    I need to validate my web app to allow both english and european
    characters (anything else I'll reject). I can do it by allowing
    individual characters in the mask i.e.
    <constant>
    <constant-name>alphaForeignCheck</constant-name>
    <constant-value>^[a-zA-Z è\s]*$</constant-value>
    </constant>

    This will allow for alphas and è. But rather than list individual
    foreign characters is there a way to group say all french all german
    characters?
     
    mdjj, Mar 31, 2006
    #1
    1. Advertisements

  2. mdjj

    Oliver Wong Guest

    Unicode code charts are at: http://www.unicode.org/charts/

    You'll probably want \u00c0 to \u00FF, except not \u00f7 and \u00d7. You
    might want to also look at Latin Extended A and Latin Extended B.

    Perhaps you can save yourself a lot of effort and do the validation in Java,
    via Character.isLetter()

    - Oliver
     
    Oliver Wong, Mar 31, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.