Skip to content

Commit b0e0131

Browse files
committed
Use codecs.open in name_generator.py so namefiles can support unicode
1 parent 553543f commit b0e0131

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

plugins/name_generator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import codecs
23
import os
34

45
from cloudbot import hook
@@ -43,7 +44,9 @@ def namegen(text, bot, notice):
4344
return "{} is not a valid name generator.".format(inp)
4445

4546
# load the name generator
46-
with open(os.path.join(bot.data_dir, "name_files", "{}.json".format(selected_module))) as f:
47+
path = os.path.join(bot.data_dir, "name_files", "{}.json".format(selected_module))
48+
49+
with codecs.open(path, encoding="utf-8") as f:
4750
try:
4851
generator = get_generator(f.read())
4952
except ValueError as error:

0 commit comments

Comments
 (0)