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, gvanrossum, loewis, vbr
Date 2008-01-11.00:19:27
SpamBayes Score 0.0054151714
Marked as misclassified No
Message-id <1200010770.13.0.303800445565.issue1688@psf.upfronthosting.co.za>
In-reply-to
Content
Isn't it enough to encode the prompt with the console encoding, instead
of letting the default utf-8 conversion? This patch corrects the issue
on Windows:

Index: ../Python/bltinmodule.c
===================================================================
--- ../Python/bltinmodule.c     (revision 59843)
+++ ../Python/bltinmodule.c     (working copy)
@@ -1358,12 +1358,19 @@
                else
                        Py_DECREF(tmp);
                if (promptarg != NULL) {
-                       po = PyObject_Str(promptarg);
+                       PyObject *stringpo = PyObject_Str(promptarg);
+                       if (stringpo == NULL) {
+                               Py_DECREF(stdin_encoding);
+                               return NULL;
+                       }
+                       po = PyUnicode_AsEncodedString(stringpo,
+                               PyUnicode_AsString(stdin_encoding), NULL);
+                       Py_DECREF(stringpo);
                        if (po == NULL) {
                                Py_DECREF(stdin_encoding);
                                return NULL;
                        }
-                       prompt = PyUnicode_AsString(po);
+                       prompt = PyString_AsString(po);
                        if (prompt == NULL) {
                                Py_DECREF(stdin_encoding);
                                Py_DECREF(po);
History
Date User Action Args
2008-01-11 00:19:30amaury.forgeotdarcsetspambayes_score: 0.00541517 -> 0.0054151714
recipients: + amaury.forgeotdarc, gvanrossum, loewis, christian.heimes, vbr
2008-01-11 00:19:30amaury.forgeotdarcsetspambayes_score: 0.00541517 -> 0.00541517
messageid: <1200010770.13.0.303800445565.issue1688@psf.upfronthosting.co.za>
2008-01-11 00:19:28amaury.forgeotdarclinkissue1688 messages
2008-01-11 00:19:27amaury.forgeotdarccreate