Some encoding fixes for windows. Not sure if this will work on posix
based systems.