Sunday, 30 August 2009

Java's tale on OS locales

As a Java developer who is not living in 'english' locale zone, he first thing I do is to change my locale to english whenever I face a new computer. However this is not a natural born reflex I had. Here is the story, why..

It was the year 2003/4 when I started working as an enterprise Java developer in a bank. My first assignment was to solve a problem where the java code which used to work fine on developer computer, failed to connect a network resource. As someone not familiar with the app, I switched to debug mode and deep dive into. After a while I figured out what was wrong. It was just a small innocent character which acts differently in different locales. The character 'i' becomes 'I' when its in caps although in Turkish locale it becomes a totaly different character of 'İ' which is not good for a network address. I don't remember why the app needs to change the case but its clear that its breaking the system.
Later I realised most of the webspehere/rational tool installs and uninstalls fails because of my locale. The funny thing is, since the error is something very unexpected for a developer not familiar with turkish characters usuallly it is not handled well, just displaying an error message of 'nullPointerException' or sometimes not even that. Also when you google the problem nothing pops up since this is a problem occuring only in your locale which very few people should be facing.
After a while I started working in a media company for building JavaME games. I was free to choose my own IDE, so I checked and decide to try EclipseME. After few attempts to install, I decided to google the problem I'm facing. Strangely the only posts stating the same problem were Turkish guys so I didn't even bother to read the posts. Instead I go in to locale settings and change to english, which let eclipseME install smoothly.
We had a group of friends playing Football Manager online. However none of us able to install and run as Football Manager 4 was released. There were no one on the inernet mentioning such a problem but we couldn't able to play. Later I heard that the installer was written in Java, as you can guess it didn't take long to set up our network to play again the new version, and any one willing to change the locale were welcome.
As I move to my next job in Istanbul Airport, I was enough experienced to check the locale settings when I face a strange problem. I remember fixing at least 3-4 times of localization settings. The worst part is, such problems occur may be only once or at most twice a in 1-2 years which doesnt make you think about checking the locale. I remember colleagues to become very suprised when changing the locale when I ask my help and then telling them to check again in snob way ;)
I remember facing much or less the similar problems on Flex which is quite normal. It has jre under the hood and working on top of eclipse but the latest problem which I faced (actually not me, my locale is english) was quite intresting. In mid June I gave a flex course in a bank, and one of the attendee was saying that the flex builder asks the registration key each time although it accepts the key everytime she enters. After trying few times, I dive into property files and saw that flex was able to write the key to the file, however, on startup the builder was asking again. I decided to unistall and install again. Guess what, the uninstaller quited unexpectedly with a message of null. As anyone read so far can guess I changed the locale, reenter the registration key and it has gone..
The problems with locales such as Turkish, are not daily problems but be sure they will appear the moment you expect the less. Working with or on anything related to Java? either set the locale of your IDE to english or just like me set the locale of your OS. I never had any problems or missed any features because of using english locales so far, either in windows, or linux, or macos..