python3 - the hardest hello world ever ?

T

Terry Reedy

Helmut said:
I have always worked with latin-1 strings with an US locale under
python-2.x with x < 6 (I haven't tried 2.6, though). I hope to switch to
3.0 as soon as possible.

Having the luxury of not needing 3rd party extensions for my current
work, I already have, and love it.

A few month ago I still thought I had no personal need for Unicode.
Then my daughter announced that she wanted to learn Japanese. My mind
was changed.

We will all be happier, I think, when output devices routinely accept
UTF-8 streams and display the full current Unicode character set.

tjr
 
R

Ross Ridge

Helmut Jarausch said:
# but this ugly one (to be done for each output file)
sys.stdout._encoding='latin1'

Is this writable "_encoding" attribute, with a leading underscore (_),
documented anywhere? Does it actually work? Would it happen to be
supported in 2.5 or 2.6? The fact that I can't change the encoding
attribute of sys.stdout/stderr/stdin has caused problems for me in
the past.

Ross Ridge
 
H

Helmut Jarausch

Ross said:
Is this writable "_encoding" attribute, with a leading underscore (_),
documented anywhere? Does it actually work? Would it happen to be
supported in 2.5 or 2.6? The fact that I can't change the encoding
attribute of sys.stdout/stderr/stdin has caused problems for me in
the past.

Yes, it does work in python-3.



--
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
 
H

henning.vonbargen

Many thanks, it works when setting the LANG environment variable.

BTW:
For Windows users, when running Python command-line programs,
you can also modify the properties of the "cmd.exe" window and
tell windows to use the TT Lucida Console font instead of the raster
font.

Then, before starting the Python program, do a
CHCP 1252
This way the sys.stdout.encoding will be cp1252
(tested with Python 2.4.3 and 2.5.1).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top