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

[patch][7.4a] :py3 vim.eval() doesn't handle multibyte characters properly

Expand Messages
  • Ken Takata
    Hi, ... when encoding is not utf-8 (e.g. cp932). ... Traceback (most recent call last): File , line 1, in UnicodeDecodeError: utf-8
    Message 1 of 2 , Jul 9, 2013
    • 0 Attachment
      Hi,

      :py3 vim.eval() doesn't handle multibyte characters properly
      when 'encoding' is not utf-8 (e.g. cp932).

      How to reproduce:

      :set enc=cp932
      :call setline(1, "\u82a0") " Set Hiragana Letter A 'あ' (U+3042 in Unicode)
      :py3 import vim
      :py3 print(vim.eval('getline(1)')) " Printing 'あ' is expected.
      Traceback (most recent call last):
      File "<string>", line 1, in <module>
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 0: invalid start byte

      Attached patch fixes this problem.
      Please check it.

      Regards,
      Ken Takata

      --
      --
      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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Bram Moolenaar
      ... Thanks, I ll include it. -- Communication is one of the most compli..., eh, well, it s hard. You know what I mean. Not? /// Bram Moolenaar --
      Message 2 of 2 , Jul 9, 2013
      • 0 Attachment
        Ken Takata wrote:

        > :py3 vim.eval() doesn't handle multibyte characters properly
        > when 'encoding' is not utf-8 (e.g. cp932).
        >
        > How to reproduce:
        >
        > :set enc=cp932
        > :call setline(1, "\u82a0") " Set Hiragana Letter A 'あ' (U+3042 in Unicode)
        > :py3 import vim
        > :py3 print(vim.eval('getline(1)')) " Printing 'あ' is expected.
        > Traceback (most recent call last):
        > File "<string>", line 1, in <module>
        > UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 0: invalid start byte
        >
        > Attached patch fixes this problem.
        > Please check it.

        Thanks, I'll include it.

        --
        Communication is one of the most compli..., eh, well, it's hard.
        You know what I mean. Not?

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ an exciting new programming language -- http://www.Zimbu.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

        --
        --
        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

        ---
        You received this message because you are subscribed to the Google Groups "vim_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.