[Patches] [ python-Patches-866982 ] Bad behavior of
email.Charset.Charset when locale is tr_TR
SourceForge.net
noreply at sourceforge.net
Tue Jan 20 15:52:19 EST 2004
Patches item #866982, was opened at 2003-12-29 05:29
Message generated for change (Settings changed) made by bwarsaw
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=866982&group_id=5470
Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 7
Submitted By: Matthias Klose (doko)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: Bad behavior of email.Charset.Charset when locale is tr_TR
Initial Comment:
Charset class' behaviour is bad when locale is set to
tr_TR. The problems's source is input_charset =
input_charset.lower() at line 393 of
/usr/lib/python2.3/email/Charset.py . This exeample
code can reproduce the error:
import locale
from email.Charset import Charset
locale.setlocale(locale.LC_ALL,("tr_TR","ISO-8859-9"))
foo = Charset(locale.nl_langinfo(locale.CODESET))
repr(foo) #Returns \xfdso-8859-9 which is not a charset
instead of iso-8859-9
The problem exists because the lower() of I in turkish
charset is ý (\xfd), not i. I will try to create and
submit a patch ASAP.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2003-12-29 12:29
Message:
Logged In: YES
user_id=21627
See the python-dev discussion. My proposal is to add
ascii_lower to <type 'str'>, and use that. Charset.py might
then use your code as a fallback.
Actually, it might be even more performant to do
lower_map = string.maketrans(string.ascii_upper,
string.ascii_lower)
def _ascii_lower(str):
return str.translate(lower_map)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=866982&group_id=5470
More information about the Patches
mailing list