classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How does GNU classpath implement char?


From: David Holmes
Subject: RE: How does GNU classpath implement char?
Date: Wed, 14 Sep 2005 11:44:10 +1000

> The Sun Java documentation sasy that char is a 16 bit positive value
> that has the representation of a character in UTF-16 encoding.

As of Java 5.0 that is correct. Previously Java only supported the 16-bit
Unicode standards.

> So it seems to me that only BMP characters are representable in char.
> What should be done (in programming) in order to use characters
> outside BMP?

UTF-16 allows for the encoding of all Unicode characters within 16-bit
values. The values \u0000 to \uffff are encoded directly. The values above
0x00FFFF are encoded as "surrogate pairs" using two char values.

There are methods within the Character class for working with surrogate
pairs, and also methods that deal with Unicode code points (any 21-bit
Unicode value) directly, by taking/returning int values.

Classpath is not yet Java 5.0 compatible, but people are working on that.

Cheers,
David Holmes





reply via email to

[Prev in Thread] Current Thread [Next in Thread]