How do I know that there are double-byte characters in s String?

Hi!

If I have a String that contain English and Chinese words,

How do I know that the String contain double-byte characters(Chinese words)?

Following is my method and the problem I suffered...

String A = "test(double-byte chinese)test";

byte B[] = A.getBytes();

if(A.length() != B.length)

System.out.print("String contains double-byte words");

else

System.out.print("String does not contain double-byte words");

If the String contains Chinese words,then A.length() will be smaller than B.length...

I run the program on Window NT workstation(Tradtional Chinese version) and it works...

Then I run the same program on Redhat 6.0(English version),

but the result was not the same as running on NT...

because A.length() always equal to B.length...

I guess that's because of Charset of OS...

But I don't know how to set the Charset of Linux...

Does anybody have other solution to my problem?

Any suggestion will be very appreciate!

[1054 byte] By [dong721] at [2007-9-26 1:15:55]
# 1
See class Locale, it contains country specific information there might be something to help you.
Kayaman at 2007-6-29 0:42:59 > top of Java-index,Archived Forums,Java Programming...
# 2
A String is always in Unicode. You cannot see what kind of character is in the string unless you compare with the Unicode range of charcters. E.g. 3400-4DB5 is CJKUnified Ideographs extension A. Then you at least know that is is not Latin-1 or other.Klint
saen at 2007-6-29 0:42:59 > top of Java-index,Archived Forums,Java Programming...