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 Tomoki.Imai
Recipients Tomoki.Imai, ezio.melotti, pradyunsg, terry.reedy
Date 2013-04-21.16:34:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1366562096.74.0.982375643091.issue17348@psf.upfronthosting.co.za>
In-reply-to
Content
NO,this thread should not be closed!
This is IDLE Bug.I found, IDLE has issue in using unicode literal.

In normal interpreter in console.
>>> u"こんにちは"
u'\u3053\u3093\u306b\u3061\u306f'

In IDLE.
>>> u"こんにちは"
u'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf'

I take a look IDLE codes, found bug in IDLE.
In idlelib/PyShell.py.

    def runsource(self, source):
        "Extend base class method: Stuff the source in the line cache first"
        filename = self.stuffsource(source)
        self.more = 0
        self.save_warnings_filters = warnings.filters[:]
        warnings.filterwarnings(action="error", category=SyntaxWarning)
        print(source,len(source))

        if isinstance(source, types.UnicodeType):
            from idlelib import IOBinding
            try:
                source = source.encode(IOBinding.encoding)
            except UnicodeError:
                self.tkconsole.resetoutput()
                self.write("Unsupported characters in input\n")
                return
        try:
            print(source,len(source))
            # InteractiveInterpreter.runsource() calls its runcode() method,
            # which is overridden (see below)
            return InteractiveInterpreter.runsource(self, source, filename)
        finally:
            if self.save_warnings_filters is not None:
                warnings.filters[:] = self.save_warnings_filters
                self.save_warnings_filters = None


This codes change u"こんにちは" to u'\xe3\x81\x93\xe3\x82\x93\xe3\x81\xab\xe3\x81\xa1\xe3\x81\xaf'
I commented out  following lines.

        if isinstance(source, types.UnicodeType):
            from idlelib import IOBinding
            try:
                source = source.encode(IOBinding.encoding)
            except UnicodeError:
                self.tkconsole.resetoutput()
                self.write("Unsupported characters in input\n")
                return

And now works.
Not well tested, I'll do unittest in GSoC (if I can).
History
Date User Action Args
2013-04-21 16:34:56Tomoki.Imaisetrecipients: + Tomoki.Imai, terry.reedy, ezio.melotti, pradyunsg
2013-04-21 16:34:56Tomoki.Imaisetmessageid: <1366562096.74.0.982375643091.issue17348@psf.upfronthosting.co.za>
2013-04-21 16:34:56Tomoki.Imailinkissue17348 messages
2013-04-21 16:34:56Tomoki.Imaicreate