site: Specify UTF-8 encoding for songquotes
In some cases, the default codec used by PyYAML is not UTF-8, so loading the song quotes database fails. Using the `codecs.open` helper function ensures that the contents of the file are always read with the correct character set.master
parent
b64db4092a
commit
190c63c594
4
site.py
4
site.py
|
@ -1,5 +1,6 @@
|
|||
from milla.dispatch import routing
|
||||
from webob import acceptparse
|
||||
import codecs
|
||||
import jinja2
|
||||
import milla
|
||||
import os
|
||||
|
@ -24,7 +25,8 @@ env = jinja2.Environment(
|
|||
)
|
||||
|
||||
|
||||
with open(os.path.join(os.path.dirname(__file__), 'songquotes.yml')) as f:
|
||||
songquotes = os.path.join(os.path.dirname(__file__), 'songquotes.yml')
|
||||
with codecs.open(songquotes, 'r', encoding='utf-8') as f:
|
||||
songquotes = yaml.load(f, Loader=YamlLoader)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue