# Cross platform?
Java might be WORA, but it doesn't necessarily follow from RA that one's code will work everywhere. One of my pet Eclipse RCP projects is a simple budgeting tool, and right now all it does is takes all of our downloaded bank statements and dollies them up a bit so we can browse our statements without having to go online.
I soon noticed two oddities when running the app in Gnome as opposed to Windows.
First, all the £ symbols in statement description fields were broken. Doh, I was using a FileReader to open the file. FileReaders just inherit the platform's default character encoding, which meant that on Linux, the default charset is UTF-8. The downloaded .csv files aren't UTF-8, they're ISO-8859-1 or whatever CP equivalent Windows uses. How often do Java developers take the time to think about and specify a character set when opening a file? Not often in my case, until tonight. How often do you even know what character set you're going to have to deal with? To work around the problem I had to subject myself to Java I/O constructor hell:
BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(fileName), "ISO-8859-1"));
Second, I use JFace's FormToolkit to create web-style forms. I noticed that on Gnome, all form fields were missing their borders. Why? Turns out that internally, FormToolkit decides how to specify the border based on the current operating system, and for some reason, borders aren't set by default for Gnome. I'm sure there was a reason for this some time in the past, but this seems a bit broken to me, now. To fix it, I had to explicitly set a border style for the toolkit, and I'll have to remember to do it for every form I create down the line.
And hope that whatever new work I do, doesn't look too shitty on Windows.
File under: java : {2007.08.06 - 00:13}