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.
Created on 2011年10月18日 11:50 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg145801 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年10月18日 11:50 | |
It's difficult to use unicode_encode_call_errorhandler() because the caller has to: - resize the output buffer (and check for integer overflow on the new size) - handle bytes and str for the replacement string: PyUnicode_EncodeDecimal() doesn't support bytes for example - encode replacement str: some encoders uses ASCII, unicode_encode_ucs1() uses Latin1, PyUnicode_EncodeCharmap() uses a recursive call (without check for infinite loop!), ... ; and raise a UnicodeEncodeError if the encoding fails It would be nice to factorize this code. I plan this implement this refactoring, it's just a reminder for me :-) |
|||
| msg145802 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2011年10月18日 12:05 | |
+1 |
|||
| msg178909 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年01月03日 02:55 | |
I tried to factorize the code, but it is too complex. Each encoder handles errors differently. The most tricky is charmap: it reencodes the result of the error handler for non-ASCII characters. I'm not happy with the current situtation, but I don't see how to factorize easily the code, so I prefer to leave it unchanged. I close the issue. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:22 | admin | set | github: 57418 |
| 2013年01月03日 02:55:57 | vstinner | set | status: open -> closed resolution: wont fix messages: + msg178909 |
| 2011年11月29日 21:13:31 | vstinner | unlink | issue12892 dependencies |
| 2011年10月26日 04:34:05 | ezio.melotti | link | issue12892 dependencies |
| 2011年10月18日 12:05:48 | ezio.melotti | set | nosy:
+ ezio.melotti messages: + msg145802 stage: needs patch |
| 2011年10月18日 11:50:10 | vstinner | create | |