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

To detect the chinese characters i have used the following condition (and it is 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)

Similarly

To identify any language characters (say arabic, hindi etc……….)

we need to know the unicode block name for that language and need to apply the similar condition as shown above.

See the below link for more details
http://forums.sun.com/thread.jspa?forumID=31&threadID=5341202

Advertisement



    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Connecting to %s



Follow

Get every new post delivered to your Inbox.