Fix some unicode handling errors.

Many thanks to Georger Araujo for pointing out these as they
cause problems on Windows.