Skip to content

Commit

Permalink
Fix bug with html templates and non-ascii
Browse files Browse the repository at this point in the history
This arises when a date substitution uses a localised month name with
accents such as the German for March.

Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Mar 4, 2017
1 parent 2d2dbf4 commit 1046e55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/pywws/Template.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-16 pywws contributors
# Copyright (C) 2008-17 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -442,7 +442,10 @@ def jump(idx, count):
fmt = fmt.encode(file_encoding)
x = x.strftime(fmt)
if sys.version_info[0] < 3:
x = x.decode(file_encoding)
if self.encoding == 'html':
x = x.decode('ascii', errors='xmlcharrefreplace')
else:
x = x.decode(file_encoding)
yield x
elif not use_locale:
yield fmt % (x)
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '17.02.0'
_release = '1373'
_commit = '73907d3'
__version__ = '17.03.0'
_release = '1374'
_commit = '2d2dbf4'

0 comments on commit 1046e55

Please sign in to comment.