On Wed, Nov 07, 2012 at 08:47:18PM -0000, Barry Warsaw wrote:
> A couple of quick thoughts: you might want to use "utf-8" instead of "utf8". It doesn't matter in practice, but better matches what getpreferredencoding() returns. Very minor nit.
Thanks, I will have to look in more details, but afaict this is also
because we get the data as bytes sometimes.
> decoding the results of sys.stdin.readline() also looks a bit suspect to me, since that should already return str instead of bytes. Are you sure that works? See also `python3 -h` and the PYTHONIOENCODING envar.
This code runs under py2 most of the time as the upgrade needs to be
support back to precise with the default install there. I.e.:
$ python -c 'import sys; print sys.getdefaultencoding()'
ascii
On Wed, Nov 07, 2012 at 08:47:18PM -0000, Barry Warsaw wrote: oding() returns. Very minor nit.
> A couple of quick thoughts: you might want to use "utf-8" instead of "utf8". It doesn't matter in practice, but better matches what getpreferredenc
Thanks, I fixed that.
> Also, in Python 3, we're generally calling subprocess. Popen(. .., universal_ newlines= True) now so that you can send unicode to the subprocess instead of bytes. That may avoid a call to .encode() below. docs.python. org/3/library/ subprocess. html#frequently -used-arguments
>
> http://
Thanks, I will have to look in more details, but afaict this is also
because we get the data as bytes sometimes.
> decoding the results of sys.stdin. readline( ) also looks a bit suspect to me, since that should already return str instead of bytes. Are you sure that works? See also `python3 -h` and the PYTHONIOENCODING envar.
This code runs under py2 most of the time as the upgrade needs to be ncoding( )'
support back to precise with the default install there. I.e.:
$ python -c 'import sys; print sys.getdefaulte
ascii
$ python3 -c 'import sys; print(sys. getdefaultencod ing())'
utf-8
And it seems like py2 does not honor PYTHONIOENCODING :/
Cheers,
Michael