diff --git a/changelog.md b/changelog.md index c80c8596..e821c84c 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ TBD Bug Fixes: ---------- * Allow `FileNotFound` exception for SSH config files. +* When opening files for execution, use the same encoding as in the database connection Features: --------- diff --git a/mycli/main.py b/mycli/main.py index 07388512..ce97494b 100755 --- a/mycli/main.py +++ b/mycli/main.py @@ -257,7 +257,7 @@ def execute_from_file(self, arg, **_): message = 'Missing required argument, filename.' return [(None, None, None, message)] try: - with open(os.path.expanduser(arg)) as f: + with open(os.path.expanduser(arg), encoding=self.sqlexecute.charset) as f: query = f.read() except IOError as e: return [(None, None, None, str(e))]