Tomoki Imai added the comment: 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). ---------- components: +IDLE -Unicode keywords: +patch nosy: +Tomoki.Imai type: -> behavior Added file: http://bugs.python.org/file29968/PyShell.py.20130422.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17348> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com