From 09aedecc3b156ee08ed556e49aac18e7e4a4c566 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 31 May 2020 20:46:12 +0100 Subject: [PATCH] Unicode fix for SVX display and edit page --- core/views_survex.py | 4 ++-- templates/svxfile.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/views_survex.py b/core/views_survex.py index f6e692f..c7d980c 100644 --- a/core/views_survex.py +++ b/core/views_survex.py @@ -95,7 +95,7 @@ class SvxForm(forms.Form): if mbeginend.group(1) != mbeginend.group(2): return "Error: mismatching beginend" - fout = open(fname, "w") + fout = open(fname, "wb") res = fout.write(rcode.encode("latin1")) fout.close() return "SAVED" @@ -109,7 +109,7 @@ class SvxForm(forms.Form): fin = open(settings.SURVEX_DATA + self.data['filename'] + ".log", "rb") log = fin.read() fin.close() - log = re.sub("(?s).*?(Survey contains)", "\\1", log) + log = re.sub(b"(?s).*?(Survey contains)", "\\1", log) return log diff --git a/templates/svxfile.html b/templates/svxfile.html index b92f067..527e13c 100644 --- a/templates/svxfile.html +++ b/templates/svxfile.html @@ -49,9 +49,9 @@ $(document).ready(function()
{% csrf_token %}
{{form.code}}
{{form.filename}} {{form.dirname}} {{form.datetime}} {{form.outputtype}}
- - - + + +