Re: the official way of printing unicode strings

2008-12-14 Thread Martin v. Löwis
> My main problem is that when I use some language I want to use it the way it > is supposed to be used. Usually doing like that saves many problems. > Especially in Python, where there is one official way to do any elementary > task. And I just want to know what is the normal, official way of prin

Re: the official way of printing unicode strings

2008-12-14 Thread Ben Finney
Piotr Sobolewski writes: > in Python (contrary to Perl, for instance) there is one way to do > common tasks. More accurately: the ideal is that there should be only one *obvious* way to do things. Other ways may also exist. > Could somebody explain me what is the official python way of > printi

Re: the official way of printing unicode strings

2008-12-14 Thread J. Clifford Dyer
On Sun, 2008-12-14 at 11:16 +0100, Piotr Sobolewski wrote: > Marc 'BlackJack' Rintsch wrote: > > > I'd make that first line: > > sys.stdout = codecs.getwriter('utf-8')(sys.stdout) > > > > Why is it even more cumbersome to execute that line *once* instead > > encoding at every ``print`` statement?

Re: the official way of printing unicode strings

2008-12-14 Thread Piotr Sobolewski
Marc 'BlackJack' Rintsch wrote: > I'd make that first line: > sys.stdout = codecs.getwriter('utf-8')(sys.stdout) > > Why is it even more cumbersome to execute that line *once* instead > encoding at every ``print`` statement? Oh, maybe it's not cumbersome, but a little bit strange - but sure, I c

Re: the official way of printing unicode strings

2008-12-14 Thread Marc 'BlackJack' Rintsch
On Sun, 14 Dec 2008 06:48:19 +0100, Piotr Sobolewski wrote: > Then I tried to do this that way: > sys.stdout = codecs.getwriter("utf-8")(sys.__stdout__) > s = u"Stanisław Lem" > print u > This works but is even more combersome. > > So, my question is: what is the official, recommended Python way?

the official way of printing unicode strings

2008-12-13 Thread Piotr Sobolewski
Hello, in Python (contrary to Perl, for instance) there is one way to do common tasks. Could somebody explain me what is the official python way of printing unicode strings? I tried to do this such way: s = u"Stanisław Lem" print u.encode('utf-8') This works, but is very cumbersome. Then I tried