# Library loan tracker fix

Over the weekend I made a small change to my library load tracker script. The change has been incorporated into the script on that page, so I won’t repeat it here. In a nutshell, the script broke, not because of any changes the library made to their system (which is what has broken the script in the past), but because I didn’t allow for accented, non-ASCII characters in the data sent back from the library. As soon as my wife checked out a DVD with an “â” in the title, Python coughed up a UnicodeDecodeError, and the script shut down.

The fix was pretty simple: apply the encode('utf8') method to the strings that may have Unicode characters before printing them out. There are many places on the internet that tell you how to handle non-ASCII strings in Python; I found the Unicode section of Bruce Eckel’s Dive Into Python straightforward and helpful.

When Python 3 makes its way into the mainstream and onto my Mac, things will change for the better, and the character encoding issues I’ve run into in this and other scripts should disappear.