Windows XPでUTF8をサポートするようにコンソールを設定し、Pythonでそれを検出して動作させたいと考えています。コンソールでWindows XPでUTF8で印刷するようにする
これまでのところ、私の試みは:
C:\Documents and Settings\Philippe>C:\Python25\python.exe
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'é'
é
>>> import sys
>>> sys.stdout.encoding
'cp437'
>>> quit()
ので、デフォルトで私はCP437で午前のpythonはうまくことを検出しました。
C:\Documents and Settings\Philippe>chcp 65001
Active code page: 65001
C:\Documents and Settings\Philippe>python
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.stdout.encoding
'cp65001'
>>> print u'é'
C:\Documents and Settings\Philippe>
UTF8に印刷するPythonのクラッシュを作るようですが、今...
あなたが最初の場所で、ここでUTF8印刷考える何を作るのか? –
私はちょうど私の答えを更新しました - これはPython 3.3で追加されました。 –
も参照してください:http://stackoverflow.com/a/30505612/788700 – Adobe