1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#! /bin/sh -e
# DP: Lib/email/Charset: use locale unaware function to lower case of locale name.
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 < $0
#cd ${dir}gcc && autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
#rm ${dir}gcc/configure
;;
*)
echo >&2 "usage: `basename $0`: -patch|-unpatch [-d <srcdir>]"
exit 1
esac
exit 0
--- Lib/email/Charset.py.old 2003-12-30 10:30:34.000000000 +0100
+++ Lib/email/Charset.py 2003-12-30 10:32:24.000000000 +0100
@@ -9,6 +9,11 @@
def _isunicode(s):
return isinstance(s, UnicodeType)
+import string
+lower_map = string.maketrans(string.ascii_uppercase, string.ascii_lowercase)
+def _ascii_lower(str):
+ return str.translate(lower_map)
+
# Python 2.2.1 and beyond has these symbols
try:
True, False
@@ -212,7 +217,7 @@
"""
def __init__(self, input_charset=DEFAULT_CHARSET):
# RFC 2046, $4.1.2 says charsets are not case sensitive
- input_charset = input_charset.lower()
+ input_charset = _ascii_lower(input_charset)
# Set the input charset after filtering through the aliases
self.input_charset = ALIASES.get(input_charset, input_charset)
# We can try to guess which encoding and conversion to use by the
|