From 9fbec4faf280c700ecb9d63dea643876b561adc9 Mon Sep 17 00:00:00 2001 From: David Halter Date: Wed, 19 Dec 2012 01:32:15 +0100 Subject: [PATCH] changed something that I absolutely don't get again. #48 --- plugin/jedi_vim.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin/jedi_vim.py b/plugin/jedi_vim.py index fa35926..1fc2b68 100644 --- a/plugin/jedi_vim.py +++ b/plugin/jedi_vim.py @@ -22,8 +22,11 @@ class PythonToVimStr(encoding): __slots__ = [] def __new__(cls, s): - # VIM doesn't like UTF-8 - s = s.decode('latin-1') + # Somehow I'm not getting anything unicode related in Python + try: + s = s.decode('utf-8') + except UnicodeDecodeError: + s = unicode(s, 'latin-1') return super(PythonToVimStr, cls).__new__(cls, s) def __repr__(self): @@ -80,8 +83,8 @@ def complete(): out = [] for c in completions: - d = dict(word=c.word[:len(base)] + c.complete, - abbr=c.word, + d = dict(word=PythonToVimStr(c.word[:len(base)] + c.complete), + abbr=PythonToVimStr(c.word), # stuff directly behind the completion menu=PythonToVimStr(c.description), info=PythonToVimStr(c.doc), # docstr