summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-02-28 05:20:35 +0000
committerZac Medico <zmedico@gentoo.org>2009-02-28 05:20:35 +0000
commit31c12cf493cb7e0dd6f1e059e44ff624cf374688 (patch)
treed9e338a9a20caee33a2beccfa21829b4672d936c
parentf5fd360c50c794c19173e142fc68d745b7412afa (diff)
downloadportage-31c12cf493cb7e0dd6f1e059e44ff624cf374688.tar.gz
portage-31c12cf493cb7e0dd6f1e059e44ff624cf374688.tar.bz2
portage-31c12cf493cb7e0dd6f1e059e44ff624cf374688.zip
Add support to _ensure_default_encoding() for the same ascii and utf_8
aliases that encodings.aliases has. svn path=/main/trunk/; revision=12731
-rw-r--r--pym/portage/__init__.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 6a89c40a6..9a563a54b 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -7549,7 +7549,7 @@ def _gen_missing_encodings(missing_encodings):
class AsciiStreamReader(codecs.StreamReader):
decode = codecs.ascii_decode
- encodings['ascii'] = codecs.CodecInfo(
+ codec_info = codecs.CodecInfo(
name='ascii',
encode=codecs.ascii_encode,
decode=codecs.ascii_decode,
@@ -7559,6 +7559,11 @@ def _gen_missing_encodings(missing_encodings):
streamreader=AsciiStreamReader,
)
+ for alias in ('ascii', '646', 'ansi_x3.4_1968', 'ansi_x3_4_1968',
+ 'ansi_x3.4_1986', 'cp367', 'csascii', 'ibm367', 'iso646_us',
+ 'iso_646.irv_1991', 'iso_ir_6', 'us', 'us_ascii'):
+ encodings[alias] = codec_info
+
if 'utf_8' in missing_encodings:
def utf8decode(input, errors='strict'):
@@ -7577,7 +7582,7 @@ def _gen_missing_encodings(missing_encodings):
class Utf8StreamReader(codecs.StreamReader):
decode = codecs.utf_8_decode
- encodings['utf_8'] = codecs.CodecInfo(
+ codec_info = codecs.CodecInfo(
name='utf-8',
encode=codecs.utf_8_encode,
decode=utf8decode,
@@ -7587,6 +7592,9 @@ def _gen_missing_encodings(missing_encodings):
streamwriter=Utf8StreamReader,
)
+ for alias in ('utf_8', 'u8', 'utf', 'utf8', 'utf8_ucs2', 'utf8_ucs4'):
+ encodings[alias] = codec_info
+
return encodings
def _ensure_default_encoding():
@@ -7630,6 +7638,8 @@ def _ensure_default_encoding():
encodings[default_encoding] = encodings[default_fallback]
def search_function(name):
+ name = name.lower()
+ name = name.replace('-', '_')
codec_info = encodings.get(name)
if codec_info is not None:
return codecs.CodecInfo(