Comment 15 for bug 1171227

Revision history for this message
Jorge (skeept) wrote :

I was trying to test with adding a unicode char and this doesn't work.

The snippet is defined by
snippet testâ "abc123"
xxxô
endsnippet

and the error I get is

An error occured. This is either a bug in UltiSnips or a bug in a
snippet definition. If you think this is a bug, please report it to
https://bugs.launchpad.net/ultisnips/+filebug.

Following is the full stack trace:
Traceback (most recent call last):
  File "/home/stu/hinacio/.vim/bundle/UltiSnips/plugin/UltiSnips/__init__.py", line 23, in wrapper
    return f(self, *args, **kwds)
  File "/home/stu/hinacio/.vim/bundle/UltiSnips/plugin/UltiSnips/__init__.py", line 558, in list_snippets_dict
    _vim.command("let g:current_ulti_dict['{key}'] = '{val}'".format(key=snip.trigger, val=description))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe2' in position 4: ordinal not in range(128)

so the problematic line is
_vim.command("let g:current_ulti_dict['{key}'] = '{val}'".format(key=snip.trigger, val=description))

Any idea how I can solve this? It works fine with regular chars.

Also to make the test more robust I would like to define a snippet and get the description of the snippet in the test.
So when I define a snippet as above the dict would be {'testâ', "abc123"} but I don't know how to define a snippet with description on the test file.
Currently I am defining the snippet as
snippets = ('test', 'abc123') but in this case 'abc123' is what the snippet will be expanded to.

thanks!