Is it better to use locale.getpreferredencoding here?