Re: Print encoding problems in console

2011-07-15 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.15 07:02 PM, Pedro Abranches wrote: > Now, if you're using your python script in some shell script you > might have to store the output in some variable, like this: > > $ var=`python -c 'import sys; print sys.stdout.encoding; print > u

Re: Print encoding problems in console

2011-07-15 Thread Dan Stromberg
I've used the code below successfully to deal with such a problem when outputting filenames. Python2x3 is at http://stromberg.dnsalias.org/svn/python2x3/ , but here it's just being used to convert Python 3.x's byte strings to strings (to eliminate the b'' stuff), while on 2.x it's an identity func

Print encoding problems in console

2011-07-15 Thread Pedro Abranches
Hello everyone. I'm having a problem when outputing UTF-8 strings to a console. Let me show a simple example that explains it: $ python -c 'import sys; print sys.stdout.encoding; print u"\xe9"' UTF-8 é It's everything ok. Now, if you're using your python script in some shell script you might hav