From 1a1531cb40ac5b84e9065b74b14d49dd130fded9 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Fri, 20 Oct 2017 13:59:02 +0200 Subject: [PATCH] Use sys.getfilesystemencoding() to determine filename encoding. --- lslopt/lslparse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lslopt/lslparse.py b/lslopt/lslparse.py index 7acbc03..a20ea6d 100644 --- a/lslopt/lslparse.py +++ b/lslopt/lslparse.py @@ -2750,8 +2750,9 @@ list lazy_list_set(list L, integer i, list v) try: linenum = 0 try: - ubuiltins = builtins.decode('utf8') + ubuiltins = builtins.decode(sys.getfilesystemencoding()) except UnicodeDecodeError: + # This is just a guess at the filename encoding. ubuiltins = builtins.decode('iso-8859-15') while True: linenum += 1