Re: [ python-Patches-486375 ] Use charset in email.Utils.encode
Hello,
Sorry for replying in the Mailman list, but I'm not subscribed elsewhere, and I think the email package is crucial for Mailman, so...
On Mon, Dec 03, 2001 at 11:26:41AM -0800, noreply@sourceforge.net wrote:
Patches item #486375, was opened at 2001-11-27 22:45 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=305470&aid=486375&group_id=5470
Category: Library (Lib) Group: None
Status: Closed Resolution: Rejected Priority: 7 Submitted By: Mikhail Zabaluev (mzabaluev) Assigned to: Barry Warsaw (bwarsaw) Summary: Use charset in email.Utils.encode
Initial Comment: Here's a patch that makes email.Utils.encode actually _use_ its charset parameter. Note: a string is encoded into the specified character set using the 'replace' mode in order to provide high tolerance for missing characters, typical for email applications. The patch also slightly optimizes the code around (cough cough).
Comment By: Barry Warsaw (bwarsaw) Date: 2001-12-03 11:26
Message: Logged In: YES user_id=12800
Sorry, but this isn't correct. email.Utils.encode() states that the argument "s" must already be encoded in the given character set. The charset argument is required because Python can't guess what charset s is encoded in.
I just thought it would be nicer to specify charset once: email.Utils.encode(s, 'cp1251', 'b') , not like this: email.Utils.encode(s.encode('cp1251'), 'cp1251', 'b')
The argument "s" could be reconsidered as a Unicode string. This would constitute a better symmetry with email.Utils.decode, no?
-- Stay tuned, MhZ JID: mookid@jabber.org
Conformity is the refuge of the unimaginative.
participants (1)
-
Mikhail Zabaluev