On Thu, Nov 04, 2010 at 05:16:40PM +0800, winterTTr wrote:
> 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?
> 

Hi, there, thers's a guy also found this, see

  http://bluegene8210.is-programmer.com/posts/21513.html (Chinese)

This can be fixed by changing the (about) 74th line of
src/if_python3.c to

  #define PyString_Size(obj) PyBytes_GET_SIZE(PyUnicode_AsEncodedString(obj, 
"utf-8", NULL))

But this won't fix everything. (And on Windows, "utf-8" probably won't
work.) There are still some bugs about encoding in Python3 support.
(Sorry I don't remember what they are.) None of the released patches
fixed them.

-- 
Best regards,
lilydjwg

我的博客 http://lilydjwg.is-programmer.com/

-- 
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui