homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, christian.heimes, ezio.melotti, mark, pitrou, tzot, vstinner
Date 2009年05月19日.09:46:11
SpamBayes Score 5.895978e-11
Marked as misclassified No
Message-id <1242726374.68.0.248484835786.issue1602@psf.upfronthosting.co.za>
In-reply-to
Content
an immediate thing to do is to declare cp65001 as an encoding:
Index: Lib/encodings/aliases.py
===================================================================
--- Lib/encodings/aliases.py (revision 72757)
+++ Lib/encodings/aliases.py (working copy)
@@ -511,6 +511,7 @@
 'utf8' : 'utf_8',
 'utf8_ucs2' : 'utf_8',
 'utf8_ucs4' : 'utf_8',
+ 'cp65001' : 'utf_8',
 ## uu_codec codec
 #'uu' : 'uu_codec',
This is not enough unfortunately, because the win32 API function
WriteFile() returns the number of characters written, not the number of
(utf8) bytes:
>>> print("\u0124\u0102" + 'abc')
ĤĂabc
c
[44420 refs]
>>>
Additionally, there is a bug in the ReadFile, which returns an empty
string (and no error) when a non-ascii character is entered, which is
the behavior of an EOF condition...
Maybe the solution is to use the win32 console API directly...
History
Date User Action Args
2009年05月19日 09:46:15amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, tzot, pitrou, vstinner, christian.heimes, mark, ezio.melotti
2009年05月19日 09:46:14amaury.forgeotdarcsetmessageid: <1242726374.68.0.248484835786.issue1602@psf.upfronthosting.co.za>
2009年05月19日 09:46:13amaury.forgeotdarclinkissue1602 messages
2009年05月19日 09:46:12amaury.forgeotdarccreate

AltStyle によって変換されたページ (->オリジナル) /