Fix 'LocaleError: unknown encoding:' on Mac OS X

Should fix issue #25.