Issue 3739: unicode-internal encoder reports wrong length
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) * ![]() |
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) * ![]() |
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) * ![]() |
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) * ![]() |
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:38 | admin | set | github: 47989 |
| 2009-05-06 15:14:01 | vstinner | set | messages: + msg87336 |
| 2009-05-06 14:45:28 | doerwalter | set | status: open -> closed resolution: fixed messages: + msg87335 |
| 2009-05-04 20:00:13 | vstinner | set | files:
+ issue3739.patch nosy:
+ vstinner keywords: + patch |
| 2008-08-30 13:05:18 | doerwalter | create | |
