Wednesday, December 2, 2009

GWT - Unicode Characters

Sometimes simple 1 minute tasks make you stop and spend 20 minutes figuring solution out.

I've got a request to replace the label "Up" by this arrow "▲" . What could be simpler? I quickly replaced "Up" by "▲" in my Java source code. Then I tried to save my code and got the Eclipse error "Some characters cannot be mapped using "Cp1252" character encoding"...

The solution is simple. I used a nice online converter http://people.w3.org/rishida/scripts/uniview/conversion.php to get the Unicode code for the arrow character and then pasted it in my Java code like this:

String upArrrow = "\u25B2";

-=Oleg=-