From f90de0960be8b6dfe00ce0477088ee2b50762837 Mon Sep 17 00:00:00 2001 From: chriskiehl Date: Sat, 27 Jan 2018 13:53:00 -0800 Subject: [PATCH] fix bug where custom encoding wasn't being passed to open function --- gooey/gui/application.py | 2 +- gooey/gui/lang/i18n.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gooey/gui/application.py b/gooey/gui/application.py index ca654ea..08a673c 100644 --- a/gooey/gui/application.py +++ b/gooey/gui/application.py @@ -25,7 +25,7 @@ def run(build_spec): def build_app(build_spec): app = wx.App(False) - i18n.load(build_spec['language_dir'], build_spec['language']) + i18n.load(build_spec['language_dir'], build_spec['language'], build_spec['encoding']) imagesPaths = image_repository.loadImages(build_spec['image_dir']) gapp = GooeyApplication(merge(build_spec, imagesPaths)) # wx.lib.inspection.InspectionTool().Show() diff --git a/gooey/gui/lang/i18n.py b/gooey/gui/lang/i18n.py index d891a88..02f360a 100644 --- a/gooey/gui/lang/i18n.py +++ b/gooey/gui/lang/i18n.py @@ -15,12 +15,12 @@ __all__ = ['load', '_'] _DICTIONARY = None -def load(language_dir, filename): +def load(language_dir, filename, encoding): ''' Open and return the supplied json file ''' global _DICTIONARY try: json_file = filename + '.json' - with io.open(os.path.join(language_dir, json_file), 'r', encoding='utf-8') as f: + with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f: _DICTIONARY = json.load(f) except IOError: raise IOError('{0} Language file not found at location {1}. '