Loading ...
Sorry, an error occurred while loading the content.

2747python3 and multibyte strings

Expand Messages
  • Stanislav Kondratyev
    May 1, 2012
    • 0 Attachment
      Hello!

      I was experimenting with the python3 interface and I stumbled upon the
      following phenomenon. Suppose the cursor is in the string
      абвгдеёжзийклмнопрстуфхцчшщъыьэюя
      in a utf-8 encoded file. I run the following commands:
      :py3 import vim
      :py3 vim.current.line = vim.current.line
      Surprisingly last 16½ of 33 characters disappear.

      The same effect can be produced e. g. with
      :py3 l = vim.current.line
      :py3 vim.current.line = l
      However, the string l can be correctly printed and sent to vim via
      vim.command and setline. Hence I conclude that the transition from vim
      to python does not cause any loss of information. On the contrary,
      when the string is being passed from python to vim, vim (or python?)
      calculates that it is 33 ‘units’ long and copies 33 *bytes*.

      I’m running vim 7.3 on Windows 7.

      I’d like to find out whether this is a common effect and whether there
      exists an elegant way of changing multibyte strings from python3.

      Any help is appreciated. :)

      --
      You received this message from the "vim_multibyte" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 3 messages in this topic