Message8473

Author zyasoft
Recipients omatz, santa4nt, zyasoft
Date 2014-05-21.21:16:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1400706962.09.0.224685346843.issue2073@psf.upfronthosting.co.za>
In-reply-to
Content
This is an unfortunate aspect of Python's str/unicode distinction. Jython used to ignore this distinction, but it caused significant incompatibility with running standard Python code.

The fact that you can construct bytestrings out of UTF-8 sequences in this way is very much orthogonal; I should also point out that the console is a bit problematic here (https://wiki.python.org/jython/ConsoleChoices). I will stick with scripts:

# -*- coding: utf-8 -*-
val = u"schön"
print val

Does print out what we expect:

$ jython27 test_utf8.py
schön

So please use unicode for unicode strings, str (or bytes) for byte strings.

Jython 3.x will make this work much better by making the usual string type be unicode, which will align better with Java usage, but that's very much vaporware for now.
History
Date User Action Args
2014-05-21 21:16:02zyasoftsetmessageid: <1400706962.09.0.224685346843.issue2073@psf.upfronthosting.co.za>
2014-05-21 21:16:02zyasoftsetrecipients: + zyasoft, santa4nt, omatz
2014-05-21 21:16:02zyasoftlinkissue2073 messages
2014-05-21 21:16:01zyasoftcreate