1From 19209469a709ec0914f82c9de23137e360e5e804 Mon Sep 17 00:00:00 2001
2From: Simon Chopin <chopin.simon@gmail.com>
3Date: Mon, 29 Sep 2014 10:38:20 +0200
4Subject: [PATCH] Explicit the UTF-8 encoding also when installing using Python
5 3
6
7If the locale isn't UTF-8, or for some reason Python doesn't pick up on
8it, it will try to decode using ASCII, which will of course cause
9mayhem, crash and despair.
10
11This patch will be shipped with the Debian package 1.1.0-1
12---
13 setup.py | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/setup.py b/setup.py
17index eafe5ea..0732fe3 100644
18--- a/setup.py
19+++ b/setup.py
20@@ -18,9 +18,10 @@
21
22 def _read(fn):
23 path = os.path.join(os.path.dirname(__file__), fn)
24- data = open(path).read()
25 if sys.version_info[0] < 3:
26- data = data.decode('utf8')
27+ data = open(path).read().decode('utf8')
28+ else:
29+ data = open(path, encoding='utf8').read()
30 # Special case some Unicode characters; PyPI seems to only like ASCII.
31 data = data.replace(u'\xe1', u'a')
32 data = data.replace(u'\u0161', u's')