Marc 'BlackJack' Rintsch wrote:

First, thank you for the informative responses.

The windows command prompt expects cp437 because that's what old DOS programs print to it.

Grrr. When the interpreter runs, it opens the command prompt window with Python running, and the window closes when Python exits, so there are no other programs involved. I don't suppose there is anyway to tell Command Prompt to accept something better.

But OOo works with unicode internally, so there's no communication with outside programs involved here.

Python 3 uses unicode internally also, but I gather CommandPrompt is an outside program used as a quick substitute for coding a plain window with MFC, for instance.

----------------------
I did some experiments.

I added the /u flag after cmd.exe in the Command Prompt shortcut and the font to Lucida Console (which people on the web say handles unicode).

I opened the prompts window and entered 'chcp 1252' the same codepage as IDLE. Start Python3.
>>> import sys
>>> sys.stdout.encoding
'cp1252'
>>> '\u012b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python30\lib\io.py", line 1428, in
    b = encoder.encode(s)
  File "C:\Program Files\Python30\lib\encodings\cp1252.py", <etc>
same with raster font choice.

chcp 65001, which supposedly is UTF-8, disables all output. Perhaps Python does not recognize it as a synonym for UTF-8.

The same on IDLE (with codepage 1252) gives i macron (bar on top). So something else is going on other than just codepage.

I tried a second time and instead got "'\u012b'" and no error. Hooray, I thought, but I closed and tried again the same way, as best I know, but got the same error as before. Cp65001 also did and then did not work. Python does notice the code page change.

tjr

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to