homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: unicode-internal encoder reports wrong length
Type: Stage:
Components: Unicode Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, vstinner
Priority: normal Keywords: patch

Created on 2008年08月30日 13:05 by doerwalter, last changed 2022年04月11日 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue3739.patch vstinner, 2009年05月04日 20:00
Messages (4)
msg72193 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2008年08月30日 13:05
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)
I would have expected it to output:
(b'a\x00', 1)
instead.
msg87161 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009年05月04日 20:00
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).
msg87335 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2009年05月06日 14:45
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.
msg87336 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2009年05月06日 15:14
> I didn't check it into release26-maint and release30-maint.
I agree and anyway this encoder is not really important (it looks to 
be unused...). Thanks for the commit.
History
Date User Action Args
2022年04月11日 14:56:38adminsetgithub: 47989
2009年05月06日 15:14:01vstinnersetmessages: + msg87336
2009年05月06日 14:45:28doerwaltersetstatus: open -> closed
resolution: fixed
messages: + msg87335
2009年05月04日 20:00:13vstinnersetfiles: + issue3739.patch

nosy: + vstinner
messages: + msg87161

keywords: + patch
2008年08月30日 13:05:18doerwaltercreate

AltStyle によって変換されたページ (->オリジナル) /