summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorgy Frolov <gosha@fro.lv>2021-02-19 03:06:37 +0300
committerGeorgy Frolov <gosha@fro.lv>2021-02-19 03:08:37 +0300
commit4417c8af99649e914a985e04217f9324f9852198 (patch)
tree09f633e7d6f51891b87c83fa21fbc73df16fa6b3
parenta4fa04bbedb20b48ed3950e02266efa1645c2074 (diff)
when opening a file for execution, use the same encoding as in the database connectorpasenor/file-encoding-for-source-command
-rw-r--r--changelog.md1
-rwxr-xr-xmycli/main.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index c80c859..e821c84 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 0738851..ce97494 100755
--- a/mycli/main.py
+++ b/mycli/main.py
@@ -257,7 +257,7 @@ class MyCli(object):
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))]