Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
created March 17, 2013 · complexity basic · version 7.0
When scripting Vim using Python, the following error may occur when passing a utf-8 encoded string from Python to Vim:
:py print u'echo "\u2026"' Traceback (most recent call last): File "<string>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2026' in position 6: ordinal not in range(128)
The following example shows how to avoid the problem:
python << EOS uniStr = u"\u2026" str = uniStr.encode( vim.eval("&encoding") ) print str EOS
Or, the following one liner:
:py print u"\u2026".encode( vim.eval("&encoding") )
- Vim mailing list origin of this tip: see discussion for more information