java-gnome 4.0.13 released!

This blog post is an extract of the release note from the NEWS file which you can read online … or in the sources, of course!

java-gnome 4.0.13 (27 Aug 2009)

Unicode. It’s bigger than you think.

This is a bug fix release to address a serious weakness in Java’s handling of Unicode characters.

Unicode handling

It turns out that Java’s chars are not pure Unicode codepoints. Most people know that Java String objects are arrays of Java chars, but in aggregate they are encoded in UTF-16 in order to deal with the fact that there are Unicode characters whose index is higher than 0xFFFF and which need more than two bytes to identify them. It’s a problem that an application developer has to deal with if they’re using high-range “supplementary” Unicode characters, but wasn’t something that would break java-gnome…

Except it turns out that the Java VM does not do UTF-8 translation properly. It has a hard wired limitation preventing it from writing out UTF-8 sequences longer than 3 bytes. Who knows what crack they were smoking when they decided that one. But things like TextView / TextBuffer work in characters, so we need characters. (actually, they work in UTF-8 bytes, but the offsets in our public API are the characters variants).

Luckily, we can get at the raw UTF-16 arrays backing Strings, and so in combination with GLib’s character set conversion functions, we’ve been able to redo our string handling internally so as to have correct treatment of Unicode codepoints. Lots of testing.

This surgery was almost entirely internal; Strings returned by java-gnome methods are of course still Java String objects.

New coverage

This release also features the work of Guillaume Mazoyer exposing some of the new features available in Entry Widgets, including displaying icons and showing progress bars in the background. This compliments other minor enhancements to various miscellaneous classes.

With this release, java-gnome now requires GTK 2.16 or newer.

This release is already packaged for Gentoo and Ubuntu, which is sweet.

You can download java-gnome’s sources from ftp.gnome.org_, or easily checkout a branch from_ ‘mainline:

$ bzr checkout bzr:// java-gnome

though if you’re going to do that you’re best off following the instructions in the HACKING guidelines.