Saturday, October 15, 2005

Windows Notepad Issue

So, I wasted some time today trying to track down a phantom bug in my code at work. Turns out it wasn't a bug in my code after all. What I encountered was simply odd behavior exhibited by Windows' Notepad program due to ambiguity in determining whether a text file is Unicode or not. Anyway, here's a way to reproduce what I ran into.

Try this:

1) Open up Notepad.
2) Enter the following text, but do not insert an endline: x = 5000
3) Save the file, but be sure to choose ANSI format.
4) Close Notepad.

Now, try opening up the file in Notepad. Notice that the text is screwed up. Use any other text editor, like Wordpad, Word, UltraEdit, etc. And, you'll see it works fine.

Lame. Here's a link to a text file that was created as I described in the instructions above (for those who can't get it working): Download Here using a "save link as..."

No comments: