This modifies userpath.utils.get_flat_output() to encode the result from stdout using the locale's preferred encoding (presumably what is being used to encode the output of the subprocess.Popen stdout). We use locale.getpreferredencoding(False) to accomplish this to ensure maximum compatibility back to Python 2.7.
Previously the code used hard-coded "utf-8" encoding to decode stdout, and this may not be correct for some platforms, possibly resulting in a UnicodeError.
Closes #35 .
This modifies
userpath.utils.get_flat_output()
to encode the result from stdout using the locale's preferred encoding (presumably what is being used to encode the output of thesubprocess.Popen
stdout). We uselocale.getpreferredencoding(False)
to accomplish this to ensure maximum compatibility back to Python 2.7.Previously the code used hard-coded
"utf-8"
encoding to decode stdout, and this may not be correct for some platforms, possibly resulting in aUnicodeError
.