Serhiy Storchaka <storch...@gmail.com> added the comment:
May be I did not correctly understand the problem, but I can assume,
that this patch solves it.
'Агов!\U00010000'
----------
keywords: +patch
Added file: http://bugs.python.org/file25244/idle_escape_nonbmp.patch
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14304>
_______________________________________
diff -r 13307eb5bf47 Lib/idlelib/rpc.py
--- a/Lib/idlelib/rpc.py Sat Apr 14 14:20:29 2012 -0500
+++ b/Lib/idlelib/rpc.py Mon Apr 16 20:08:12 2012 +0300
@@ -615,10 +615,8 @@
try:
sys.stdout.write(text)
except UnicodeEncodeError:
- # let's use ascii while utf8-bmp codec doesn't present
- encoding = 'ascii'
- bytes = text.encode(encoding, 'backslashreplace')
- text = bytes.decode(encoding, 'strict')
+ # escape non-BMP characters
+ text = ''.join(c if ord(c) <= 0xffff else '\\U%08x' % ord(c) for c in
text)
sys.stdout.write(text)
sys.stdout.write("\n")
builtins._ = value
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com