• 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

validating multibyte characters

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,
Facing an issue :

Have a HTML form with a single textbox .
This data needs to be inserted into a database table ( max field length = 20 varchar2(20))

Once the form is submitted - I am checking length of the submitted data and if length is > 20 give a error message.

This works for english characters - but if I enter multibyte characters
then the Java code that is checking length seems to pass .

However at oracle end - throws an error
and when I check using the function lengthb available with oracle
it shows the length of the data to be much more than 20

Can someone help me with checking length of data ( multibyte or otherwise )
in such a scenario.

Thanks in advance ,
-Anagha
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the encoding of your database and your application/JVM ?

I would take it in this way.First of all I would like to normalize the encodings.If the encoding followed by application is different then that of the database then I would like to make those same before making any comparison.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This blog entry is also relevant on the topic of counting characters.
[ May 29, 2007: Message edited by: Ulf Dittmer ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
This blog entry is also relevant on the topic of counting characters.



This blog entry is very interesting and informative , but it explains about supplementary character manipulation using JDK - 1.5.

If the encoding of the application and database is different then also there would be error , even if we find that the number of characters is same in application as defined for the database column.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic