summaryrefslogtreecommitdiffstats
path: root/pym/portage/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'pym/portage/__init__.py')
-rw-r--r--pym/portage/__init__.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 72cdf2dbb..901ea2c96 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -158,9 +158,20 @@ _encodings = {
'stdio' : 'utf_8',
}
-# This can happen if python is built with USE=build (stage 1).
-if _encodings['merge'] is None:
- _encodings['merge'] = 'ascii'
+# sys.getfilesystemencoding() can return None if python is built with
+# USE=build (stage 1). If the filesystem encoding is undefined or is a
+# subset of utf_8, then we default to utf_8 encoding for merges, since
+# it probably won't hurt, and forced conversion to ascii encoding is
+# known to break some packages that install file names with utf_8
+# encoding (see bug #381509). The ascii aliases are borrowed from
+# python's encodings.aliases.aliases dict.
+if _encodings['merge'] is None or \
+ _encodings['merge'].lower().replace('-', '_') 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['merge'] = 'utf_8'
if sys.hexversion >= 0x3000000:
def _unicode_encode(s, encoding=_encodings['content'], errors='backslashreplace'):