You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The encoder for the "unicode-internal" codec reports the wrong length:
Python 3.0b3+ (py3k, Aug 30 2008, 11:55:21)
[GCC 4.0.1 (Apple Inc. build 5484)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import codecs
>>> codecs.getencoder("unicode-internal")("a")
(b'a\x00', 2)
Patch fixing unicode-internal encoder for unicode string input: return
the length of the input string (number of characters) and not the
internal size (number of bytes needed to store the text). I wrote a
small test, I hope that it will be enough (to test the function).
If the input is not an unicode string, return the number of bytes (I
leaved this case unchanged).
Activity
doerwalter commentedon Aug 30, 2008
The encoder for the "unicode-internal" codec reports the wrong length:
I would have expected it to output:
(b'a\x00', 1)
instead.
vstinner commentedon May 4, 2009
Patch fixing unicode-internal encoder for unicode string input: return
the length of the input string (number of characters) and not the
internal size (number of bytes needed to store the text). I wrote a
small test, I hope that it will be enough (to test the function).
If the input is not an unicode string, return the number of bytes (I
leaved this case unchanged).
doerwalter commentedon May 6, 2009
Checked in:
r72404,72406 (trunk)
r72408 (py3k)
As IMHO this is somewhat between a feature and a bugfix, I didn't check
it into release26-maint and release30-maint.
vstinner commentedon May 6, 2009
I agree and anyway this encoder is not really important (it looks to
be unused...). Thanks for the commit.