From 969630c5bb07db7980fe2fa6688fe0524fceaef9 Mon Sep 17 00:00:00 2001 From: Lance Albertson Date: Mon, 22 Apr 2024 10:18:54 -0700 Subject: [PATCH] Resolve issues with UnicodeEncodeError UnicodeEncodeError: 'ascii' codec can't encode character u'\xb0' in position 2: ordinal not in range(128) This ensures we encode this with utf-8 so we don't run into errors. Signed-off-by: Lance Albertson --- streamwebs_frontend/streamwebs/views/export.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/streamwebs_frontend/streamwebs/views/export.py b/streamwebs_frontend/streamwebs/views/export.py index 413c095de..ff41bc173 100644 --- a/streamwebs_frontend/streamwebs/views/export.py +++ b/streamwebs_frontend/streamwebs/views/export.py @@ -245,7 +245,8 @@ def export_cc(request, site_slug): w = west.count('1') writer.writerow([cc.school, cc.date_time, cc.site.site_name, - cc.weather, n, e, s, w, cc.est_canopy_cover]) + cc.weather, n, e, s, w, + cc.est_canopy_cover.encode('utf-8')]) return response