Message103777
Oh no :-( I realized that I removed the first message of this issue! msg100687. Copy/paste of the message:
---
This issue is a regression introduced by r72208 to fix the issue #3672.
Attached patch fixes PyUnicode_EncodeUTF8() if unicode_encode_call_errorhandler() returns an unicode string (eg. backslackreplace error handler). I don't know unicodeobject.c code (very well), and my patch should be far from being perfect.
I suppose that the maximum length of an escaped characters is 8 bytes (xmlcharrefreplace error error for U+DFFFF). When the first lone surrogate is found, reallocate the buffer to size*8 bytes. The escaped character have to be an ASCII character or an UnicodeEncodeError is raised.
Note: unicode_encode_ucs1() doesn't have hardcoded for the maximum length ot escaped string. Its code might be reused in PyUnicode_EncodeUTF8() to remove the hardcoded limits.
--- |
|
Date |
User |
Action |
Args |
2010-04-20 21:50:26 | vstinner | set | recipients:
+ vstinner, lemburg, loewis, doerwalter, pitrou |
2010-04-20 21:50:25 | vstinner | set | messageid: <1271800226.0.0.00791793966477.issue8092@psf.upfronthosting.co.za> |
2010-04-20 21:50:24 | vstinner | link | issue8092 messages |
2010-04-20 21:50:24 | vstinner | create | |
|