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

Counting characters when enc=utf-8?

Expand Messages
  • Valery Kondakoff
    Hello, vim-developers! It seems setting encoding to utf-8 breaks Gvim character counting. (Gvim 6.2c, WinXP Pro). There is an example: I created simple text
    Message 1 of 1 , May 13, 2003
    • 0 Attachment
      Hello, vim-developers!

      It seems setting encoding to utf-8 breaks Gvim character counting.
      (Gvim 6.2c, WinXP Pro). There is an example: I created simple text
      file 'count.txt' (ff=dos). This file is 434 bytes long.

      When I load this file with 'encoding=utf-8' commented out in my
      'vimrc' I see the following text on command line pannel: "count.txt"
      1L, 434C. But if I uncomment the 'encoding=utf-8' line the output will
      be: "count.txt" [converted] 1L, 441C.

      As far as I understand the character count is _not_ changed when
      converting, but wrong character count is displayed. And if I perform
      this action: '0v$' I will see the number '439' in the lower right Gvim
      corner. Another wrong value?

      I'm receiving the same result if I use 'WC.vim' script from vim.org
      ('441 bytes' - two line ending bytes are added):

      function WC() range
      echo line2byte(a:lastline+1)-line2byte(a:firstline) . " bytes"
      endfunction

      Can you help me understand what's wrong there?

      Thank you. You can download the file in question to test the issue
      ( http://www.nbk.orc.ru/temp/count.txt ). This file is in latin1
      encoding.

      --
      Best regards,
      Valery Kondakoff
      http://www.nbk.orc.ru (Ne Bey Kopytom)
      http://www.nbk.orc.ru/mtb (MTB riding in Moscow)

      PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...

      np: New Order - Run Wild (Get Ready) [stopped]
    Your message has been successfully submitted and would be delivered to recipients shortly.