DEV Community


Discussion on: Tell me a bug story

michelemauro profile image

In 2005, I was working on a B2B website that was expected to produce a .INI file for a portable WinCE terminal (think an intelligent barcode reader).

The output file was correct. But the terminal wouldn't read it.

I checked it visually, line by line, with a working file: the text was the same, after all there was little syntax that could be broken. Opened in a text editor, the two files were identical; diff output was empty.

After a couple of days of headbanging, in a desperate move I opened a working and a non-working file with an hex editor.

An saw, at the beginning of the file: FFFE vs FEFF

Try spotting that difference after 2 days of staring at the screen. That's Big Endian UTF BOM vs Little Endian one. The terminal was a Little Endian ARM, and wanted its text encoded that way. The server was a Big Endian linux on x86, if I remember correctly; an IBM WebSphere, no less.

The solution was a one-liner, adding "UnicodeLittle" in the output stream creation.

Worse time spent/solution size ratio in my carreer, as of now.