Message8624
Difference between CPython and Jython seen with this example:
# -*- coding: utf-8 -*-
import codecs
data = memoryview(b"中文")
text, decoded_bytes = codecs.utf_8_decode(data)
assert text == u"中文"
assert type(text) is unicode
assert decoded_bytes == 6
This works fine on CPython. On Jython, it fails with TypeError: utf_8_decode(): 1st arg can't be coerced to String
Current workaround is to use tobytes on the memoryview object:
text, decoded_bytes = codecs.utf_8_decode(data.tobytes()) |
|
Date |
User |
Action |
Args |
2014-06-10 20:57:28 | zyasoft | set | recipients:
+ zyasoft |
2014-06-10 20:57:28 | zyasoft | set | messageid: <1402433848.25.0.791107419198.issue2164@psf.upfronthosting.co.za> |
2014-06-10 20:57:28 | zyasoft | link | issue2164 messages |
2014-06-10 20:57:27 | zyasoft | create | |
|