[Patches] [ python-Patches-490456 ] Unicode support in email.Utils.encode
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 08 Jul 2002 19:06:59 -0700
Patches item #490456, was opened at 2001-12-07 18:11
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=490456&group_id=5470
Category: Library (Lib)
Group: None
>Status: Pending
Resolution: None
Priority: 5
Submitted By: Mikhail Zabaluev (mzabaluev)
Assigned to: Barry A. Warsaw (bwarsaw)
Summary: Unicode support in email.Utils.encode
Initial Comment:
It's essentially an updated patch 486375, this time
making a distinction of type for the passed string; if
it's Unicode, the function encodes it to the character
set specified as the charset parameter.
The reasons:
1. The function in its current version doesn't support
Unicode, throwing an exception if any non-ASCII
characters are found within it.
2. With this patch, we reach a sort of operational
symmetry on email.Utils.encode vs email.Utils.decode,
as it can be seen in the tests.
----------------------------------------------------------------------
>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-07-08 22:06
Message:
Logged In: YES
user_id=12800
I'm changing the status to Pending since I think this patch
is no longer relevant given that email.Utils.encode() is
deprecated.
----------------------------------------------------------------------
Comment By: Barry A. Warsaw (bwarsaw)
Date: 2002-06-28 23:37
Message:
Logged In: YES
user_id=12800
Sigh, sorry for taking so long to get to this.
email.Utils.encode() is deprecated now, and I'd actually
like to remove it rather than patch it. ;)
Shouldn't the Header class be used instead?
----------------------------------------------------------------------
Comment By: Mikhail Zabaluev (mzabaluev)
Date: 2001-12-11 17:52
Message:
Logged In: YES
user_id=313104
2loewis:
In a typical email application, it'd be better to display
partially encoded text than to face a hard stop when trying
to process a message, hence 'replace'. Actually, the
encoding mode could be an optional parameter, but I don't
feel like deciding on parameters for a function not
developed by me. Barry?
The isinstance part seems to be valid, I'm updating the
patch here accordingly.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-12-11 13:28
Message:
Logged In: YES
user_id=21627
The patch looks good, except that I cannot really see the
value in using "replace" for .encode. Wouldn't it be better
to get an exception if the Unicode string contains an
un-encodable character?
Also, the Python 2.2 way to spell the type test is
if isinstance(s, unicode)
This makes use of the fact that the unicode builtin is a
type now, and it supports unicode subtypes. This is a minor
change, of course.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=490456&group_id=5470