diff options
author | Martin Green <martin.speleo@gmail.com> | 2022-06-19 01:37:51 +0100 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2022-06-19 01:37:51 +0100 |
commit | 3465e9bd165a0dbbf4087a99f48a63b3baf1c428 (patch) | |
tree | 90351d94d5a7781b3c8da95db63a644f61af7566 /core/views/expo.py | |
parent | c9d7931ccb4e1db775905686f9e3286c9c8e402a (diff) | |
download | troggle-3465e9bd165a0dbbf4087a99f48a63b3baf1c428.tar.gz troggle-3465e9bd165a0dbbf4087a99f48a63b3baf1c428.tar.bz2 troggle-3465e9bd165a0dbbf4087a99f48a63b3baf1c428.zip |
test
Diffstat (limited to 'core/views/expo.py')
-rw-r--r-- | core/views/expo.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/views/expo.py b/core/views/expo.py index 6076ded..b282b40 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -131,11 +131,11 @@ def expowebpage(request, expowebpath, path): try: with open(os.path.normpath(expowebpath / path).encode(sysdefaultencoding), "r", encoding='utf-8') as o: html = o.read() - except Cave.DoesNotExist: + except: # exception raised on debian with python 3.9.2 but not on WSL Ubuntu with python 3.9.5 # because debian was assuming default text encoding was 'ascii'. Now specified explicitly so should be OK try: - with open(os.path.normpath(expowebpath / path), "rb") as o: + with open(os.path.normpath(expowebpath / path).encode(sysdefaultencoding), "rb") as o: html = str(o.read()).replace("<h1>","<h1>BAD NON-UTF-8 characters here - ") html = html.replace("\\n","\n") html = html.replace("\\r","") |