Issue1033
Created on 2008-05-03.15:22:38 by irmen, last changed 2008-05-30.18:36:07 by pjenvey.
msg3184 (view) |
Author: Irmen de Jong (irmen) |
Date: 2008-05-03.15:22:37 |
|
zlib.adler32 function computes wrong values.
This is because the data is first needlessly processed by String.getBytes,
which causes data loss due to platform character encoding issues.
Removal of the String.getBytes fixed the problem for me in zlib.py
|
msg3185 (view) |
Author: Irmen de Jong (irmen) |
Date: 2008-05-03.15:29:05 |
|
Sorry forgot to mention Jython version: 2.2.1 release.
|
msg3197 (view) |
Author: Alan Kennedy (amak) |
Date: 2008-05-24.14:28:15 |
|
As pointed out by Irmen, this bug is caused by the String.getBytes call,
which encodes the string according to the platform default encoding.
The solution is to use a specific character set, like so
checksum.update(String.getBytes(s, 'iso-8859-1'))
|
msg3198 (view) |
Author: Alan Kennedy (amak) |
Date: 2008-05-24.14:35:28 |
|
Fix checked in at revision 4441.
|
msg3199 (view) |
Author: Alan Kennedy (amak) |
Date: 2008-05-24.14:50:08 |
|
If you want to patch an existing jython 2.2.1 to eliminate this problem,
then update the zlib.adler32 function to look like this
def adler32(s, value=1):
if value != 1:
raise ValueError, "adler32 only support start value of 1"
checksum = Adler32()
checksum.update(String.getBytes(s, 'iso-8859-1'))
return Long(checksum.getValue()).intValue()
|
msg3211 (view) |
Author: Philip Jenvey (pjenvey) |
Date: 2008-05-30.18:36:06 |
|
I merged this to trunk in r4491
|
|
Date |
User |
Action |
Args |
2008-05-30 18:36:07 | pjenvey | set | nosy:
+ pjenvey messages:
+ msg3211 |
2008-05-24 14:50:18 | amak | set | messages:
+ msg3199 |
2008-05-24 14:35:28 | amak | set | status: open -> closed resolution: fixed messages:
+ msg3198 |
2008-05-24 14:28:17 | amak | set | assignee: amak messages:
+ msg3197 nosy:
+ amak |
2008-05-03 15:29:05 | irmen | set | messages:
+ msg3185 versions:
+ 2.2.2 |
2008-05-03 15:22:38 | irmen | create | |
|