summaryrefslogtreecommitdiff
path: root/reporters
diff options
context:
space:
mode:
authorSylvain Th?nault <sylvain.thenault@logilab.fr>2013-04-12 18:20:53 +0200
committerSylvain Th?nault <sylvain.thenault@logilab.fr>2013-04-12 18:20:53 +0200
commit12ba4ab01e8a5b1f525098e57c03a36edb057b26 (patch)
tree9a3f9deb5f39d4ff58f913fdc72016621f8a9579 /reporters
parent3ba0b324c613901e1818d20d3f30e6fbfc8015e4 (diff)
downloadpylint-12ba4ab01e8a5b1f525098e57c03a36edb057b26.tar.gz
closes #123892 by adding errors=replace when encoding unicode strings
Diffstat (limited to 'reporters')
-rw-r--r--reporters/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/reporters/__init__.py b/reporters/__init__.py
index 99cf2b7..fa09c1a 100644
--- a/reporters/__init__.py
+++ b/reporters/__init__.py
@@ -82,7 +82,10 @@ class BaseReporter:
encoding = (getattr(self.out, 'encoding', None) or
locale.getdefaultlocale()[1] or
sys.getdefaultencoding())
- return string.encode(encoding)
+ # errors=replace, we don't want to crash when attempting to show
+ # source code line that can't be encoded with the current locale
+ # settings
+ return string.encode(encoding, 'replace')
self.encode = encode
def writeln(self, string=''):