Thursday, November 4, 2010

python3 and unicode problem

I don't know if this is a problem already solved, my vim version on windows is
Vi IMproved 7.3 Included patches: 1-29

I found a problem like this,

when i use python3 interface to set the buffer content to a sepecific
chinese character, some kind of error occured.
the code is like below:

:py3 import vim
:py3 vim.current.buffer[0] = '例'

although this code can run without error, but the content is not
correct, turned out to be "<e4>", which seems an encoding problem.
so i try the code below

:py3 vim.current.buffer[0] = '例'.encode( vim.eval('&encoding') )

but "TypeError: bad argument type for built-in operation" comes out.

So, is there a right way to set the unicode which contains non English
charactor , to the buffer using python3 interface?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: