Repository navigation
email/charset.py convert() patch #42985
Description
Activity
email/charset.py has convert() function to incorporate
using different charset for input and output for a
language like Japanese. Because the email user agent
in Japan frequently use characters outside the range of
legitimate JIS charset, these messages are shunted in
mailman delivery. Here is a patch to handle this case
by replacing the characters by '?' using the 'errors'
parameter in unicode/encode functions.This patch includes the unicode string conversion patch
in bpo-1368247.- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Mar 6, 2006 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
on Mar 6, 2006 Logged In: YES
user_id=12800Do you have a test case for this? bpo-1368247 includes one just
for the encoding of unicode strings, but not for the error
argument. If you can include a simple test case, then I'll
add this patch.Logged In: YES
user_id=67709Thanks! Here is an example program which fails on 4.0a
without the patch.I'm -1 on this patch as-is. It changes the default error handling behavior from 'strict' to 'replace', for this method. This is a choice that the caller of these methods should make, so I think the default value for the error handling should be 'strict'. If then it is meaningful in mailman to set this to 'replace', this is mailman's choice. Python should never, on its own, create moji-bake.
If you revise this patch, please provide the test case as a patch to Lib/email/test somehow (probably patching both test_email and test_email_renamed).
Ok, I worked a little on the code to propagate the choice of 'strict' or 'replace' but there are many we should fix. And we should fix the application, mailman, also. The problem is only related to Japanese and we'd rather find workarounds elsewhere. I put the priority of this patch lowest. Thanks for your comments.
- addedtype-featureA feature request or enhancementA feature request or enhancement
on Mar 21, 2009 This issue is not newcomer friendly, I remove the easy keyword.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: