From bea71b971dedc89115bc248ce51a12719f92e0e3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 25 Sep 2023 12:21:31 +0100 Subject: [PATCH] Handle non-ASCII paths etc. See: https://github.com/RPi-Distro/rpi-source/issues/20 Signed-off-by: Phil Elwell --- rpi-source | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rpi-source b/rpi-source index 5071ada..310a395 100755 --- a/rpi-source +++ b/rpi-source @@ -98,7 +98,7 @@ def sh_out(cmd): errcode = process.returncode if errcode: return None - return out.decode('ascii') + return out.decode('utf-8') def writef(f, str, mode='w'): debug("writef(%s)" % f) @@ -109,7 +109,7 @@ def writef(f, str, mode='w'): def download(url): debug("download: %s" % url) try: - res = urllib.request.urlopen(url).read().decode('ascii') + res = urllib.request.urlopen(url).read().decode('utf-8') except urllib.error.HTTPError as e: fail( "Couldn't download %s, HTTPError: %s\n\n%s" @@ -190,7 +190,7 @@ def check_gcc(): errcode = process.returncode if errcode: debug("gcc version check failed: '%s' returned %d" %(cmd, errcode)) - gcc_ver = out.strip().decode('ascii') + gcc_ver = out.strip().decode('utf-8') with open('/proc/version', 'r') as f: proc_version = f.read() @@ -215,7 +215,7 @@ def proc_config_gz(): return '' with gzip.open('/proc/config.gz', 'rb') as f: - return f.read().decode('ascii') + return f.read().decode('utf-8') def processor_type_suffix():