Skip to content

Commit 6f8263e

Browse files
committed
Added fallback handling from utf-8 to latin1 when reading charter text files.
- Legacy-Id: 17126
1 parent d9c1944 commit 6f8263e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ietf/group/utils.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ def get_charter_text(group):
5757

5858
filename = os.path.join(c.get_file_path(), "%s-%s.txt" % (c.canonical_name(), c.rev))
5959
try:
60-
with io.open(filename) as f:
61-
return f.read()
60+
with io.open(filename, 'rb') as f:
61+
text = f.read()
62+
try:
63+
text = text.decode('utf8')
64+
except UnicodeDecodeError:
65+
text = text.decode('latin1')
66+
return text
6267
except IOError:
6368
return 'Error Loading Group Charter'
6469

0 commit comments

Comments
 (0)