Yes, that works for eval. But I want it for code entered during an interactive session. >>> u'α' u'\xce\xb1' The tokenizer gets b"u'\xce\xb1'" by calling PyOS_Readline and it knows it's utf-8 encoded. But the result of evaluation is u'\xce\xb1'. Because of how eval works, I believe that it would work correctly if the PyCF_SOURCE_IS_UTF8 was set, but it is not. That is why I'm asking if there is a way to set it. Also, my naive thought is that it should be always set in the case of interactive session. On Wed, Apr 29, 2015 at 4:59 PM, Victor Stinner <victor.stinner at gmail.com> wrote: > Le 29 avr. 2015 10:36, "Adam Bartoš" <drekin at gmail.com> a écrit : > > Why I'm talking about PyCF_SOURCE_IS_UTF8? eval(u"u'\u03b1'") -> > u'\u03b1' but eval(u"u'\u03b1'".encode('utf-8')) -> u'\xce\xb1'. > > There is a simple option to get this flag: call eval() with unicode, not > with encoded bytes. > > Victor > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20150429/46b23158/attachment-0001.html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4