File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Validating other language chars Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Validating other language chars" Watch "Validating other language chars" New topic
Author

Validating other language chars

Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Their was a requirment to validate the other language input (may be hindi or Tamil) in java. As we know localisation concepts which will take care of ONLY ocalizing the string based on the locale. However it has nothing to do with other language input.

I was thing is there any started way to identifiy a unicode is char or a integer ? and how can i find the length of the input other lang string (because string.length() will give wrong length).

Please let me also know if you guys knows any framework for this. Thank you ;)


My Thoughts : http://passion4java.blogspot.com
Try not to become a man of success but rather to become a man of value.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
I am not very sure I am getting your questions, so far I understand you would like to know what is the language of a given input.

I am pretty sure that there could be several ways to do it, but you could easily determine the unicode block of every character to know for sure if it is tamil. For instance somewhat like this could work



By doing this, you could ensure that all characters on a given text are in Tamil characters. Simply use the java.lang.Character.UnicodeBlock class as I did.

Beware however that this only checks the characters belong to the Tamil unicode block. If the input contains mixed characters, this would yield false. I do not know if the numbers are written in other character blocks in Tamil. Perhaps, you could determine the percentage of characters in Tamil in the text and from there take decisions.

This is just an idea, it is up to you how to use it.

Does this help somehow?
Mohammed Yousuff
Ranch Hand

Joined: Oct 17, 2007
Posts: 198
Thanks Edwin for your quick response ;)

let me rephrase my question, if a person giving a tamil language as a input. From java i should able to know if the given starting contains Tamil number or Tamil characters.

How to Find the length of the given input, the reason here in tamil two words "கா" represents only one in Tamil.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Sorry pal, you will need to elaborate on your question. I continue without understanding what is exactly that you would like to do. Provide some information, post some code of what you are trying to accomplish and perhaps we can help you out.
 
 
subject: Validating other language chars