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 In Java : How to detect whether a character is chinese or not? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "In Java : How to detect whether a character is chinese or not?" Watch "In Java : How to detect whether a character is chinese or not?" New topic
Author

In Java : How to detect whether a character is chinese or not?

Rama Vadakattu
Greenhorn

Joined: Oct 12, 2007
Posts: 6
In java how to detect whether a particular character is chinese character or not?

Can any one please guide me on how to solve the above problem?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32830
    
    4
Try the String.codePointAt() methods, then Character.isSupplemntaryCodePoint(). Go to the Unicode website and find what ranges of values represent Chinese characters. Compare the results of getting the code point and the Unicode charts.

And check the method names; I have probably spelt them wrongly.
Rama Vadakattu
Greenhorn

Joined: Oct 12, 2007
Posts: 6
Thanks for the guidance
to detect the chinese characters i used the following condition (detecting most of the chinese characters)..........

-----------------
if( (Character.UnicodeBlock.of(str[i]) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS) || )

-------------------
May be chinese,japnese characters fall into this UNICODE block
Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS (not very sure)


Important links
http://forums.sun.com/thread.jspa?forumID=31&threadID=5341202

{
[ October 25, 2008: Message edited by: Rama Vadakattu ]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

Yes, that's right. "CJK" means "Chinese, Japanese, Korean". And of course many Japanese kanji characters are identical in appearance to Chinese characters, so there's probably no point in trying to tell them apart.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: In Java : How to detect whether a character is chinese or not?
 
Similar Threads
How to detect the input from user is ENLGISH ONLY
Reading chinese characters through java input fields
database operation with other character set
javaw and javaw Detection from within Program
Reading chinese characters through java input fields