Author: Matti Picus <[email protected]>
Branch: unicode-utf8-py3
Changeset: r95363:a325699736bc
Date: 2018-11-23 08:59 -0600
http://bitbucket.org/pypy/pypy/changeset/a325699736bc/
Log: fix wrong unicode length
diff --git a/pypy/module/_multibytecodec/c_codecs.py
b/pypy/module/_multibytecodec/c_codecs.py
--- a/pypy/module/_multibytecodec/c_codecs.py
+++ b/pypy/module/_multibytecodec/c_codecs.py
@@ -269,7 +269,8 @@
unicodedata, start, end)
if rettype == 'u':
codec = pypy_cjk_enc_getcodec(encodebuf)
- replace = encode(codec, replace, end - start)
+ lgt = rutf8.check_utf8(replace, False)
+ replace = encode(codec, replace, lgt)
lgt = len(replace)
with rffi.scoped_nonmovingbuffer(replace) as inbuf:
r = pypy_cjk_enc_replace_on_error(encodebuf, inbuf, lgt, end)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit