Skip to content

Commit 232444c

Browse files
committed
counter mkexrc fileencoding behaviour
mkexrc writes the exrc file with an encoding detected somewhere through your vimrc file, ... With a properly encoded vimrc and such you get a nice utf-8 file, with some vimrc's there is some mixing which causes the mkexrc command to write the exrc file with latin1 or cp1250 or ... Now the reading of the temporary exrc file is done binary and the strings are converted back to utf-8 using the replace strategy. This should make sure we don't get Unicode errors while reading the file searching for maps that need replacing for proper functioning of vdebug. fixes #350 Signed-off-by: BlackEagle <ike.devolder@gmail.com>
1 parent 5e1d263 commit 232444c

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

pythonx/vdebug/util.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import sys
77
import time
88
import traceback
9-
import codecs
109
try:
1110
import urllib.parse as urllib
1211
except ImportError:
@@ -157,9 +156,9 @@ def _store_old_map(self):
157156
keys = {v for k, v in self.keymaps.items() if k not in self.exclude}
158157
special = {"<buffer>", "<silent>", "<special>", "<script>", "<expr>",
159158
"<unique>"}
160-
for line in codecs.open(tempfile, 'r', errors='ignore'):
159+
for line in open(tempfile, 'rb'):
160+
line = line.decode('utf-8', errors='replace')
161161
log.Log("keymapper: line '%s'" % line, log.Logger.DEBUG)
162-
line = line.encode('utf-8').decode('utf-8')
163162
if not regex.match(line):
164163
continue
165164
parts = split_regex.split(line)[1:]

0 commit comments

Comments
 (0)