Skip to content

Using GWT Listbox with Unicode

by dkberktas on March 31st, 2010

In our new project remotespots.com, we use GWT for the front end. Since remotespots supports two languages (English & Turkish), with a listbox we enables users to select which language they are going to use.

GWT’s Listbox is a combo box basically. GWT support HTML in most of its widgets, but this is not the case for ListBox. You can only add String instances to a listbox.

This cause problems with characters which are non-english like ö ü ç

In such a case, to overcome the problem, unicode representation should be used.

ListBox lb = new ListBox();
lb.addItem("English", "en");
lb.addItem("T\u00FBrk\u00E7e", "tr");

The full list of the unicode representations,  this link can be used. (http://unicode.org/Public/MAPPINGS/VENDORS/APPLE/TURKISH.TXT)

2 Comments
  1. Kerem permalink

    I set utf8 as the encoding of my site and of the java file that includes the ListBox. Everything works fine now. No need for the “T\u00FBrk\u00E7e” kung-foo.

  2. dkberktas permalink

    Thanks Kerem, that works perfectly! Still there is hidden pleasure doing things the hard way… No I am just kidding :)

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS