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

Codepage cp866 support ?

Expand Messages
  • Igor Prischepoff
    Hello,Vim developers! Win2k russian,MS-Windows 32 bit console vim 6.2 standard (no patches) c: chcp current code page 866 c: vim -u NONE -U NONE ...
    Message 1 of 2 , Dec 8, 2003
    • 0 Attachment
      Hello,Vim developers!
      Win2k russian,MS-Windows 32 bit console vim 6.2 standard (no patches)
      c:> chcp
      current code page 866
      c:>vim -u NONE -U NONE
      :set enc?
      encoding=cp1251
      ^^^^^^^^^^^^^^^^^^
      why is that so?
      'chcp' shows that my current code page is cp866
      ok, let's set it manually:

      :set enc=cp866
      :set tenc=cp866
      :set fenc=cp866

      Now i'm trying to enter some national chars (in cp866 codepage)-
      everything is ok. They got displayed correctly, saved correctly
      but i can not uppercase them,nor move to word boundaries with
      w,W,b,B commands.
      If i select some text in visual mode and then hit U
      they gets distorted but not uppercased.

      I've looked into mbyte.c file and there is no such codepage defined.
      Does it means that cp866 didn't supported by vim?
      But there is cp1255,cp932,cp949 etc...
      Should i define somehow my codepage and stuck it there?

      By the way cp1251 isn't there also, but with cp1251 my gvim works ok.
      Seems like no one is willing to answer this issue in vim list,so i'm
      posting here.

      I'd like to fix it myself if possible,but i need some help.
      I've got sources and like to know in which file to look.
      Where code, which handles visual mode 'U' (UPPERCASE'ing) command and
      settting codepage on startup, is located.
      Then may be i will be able to fix this myself.
      And where is code which supports different codepages. (my guess -
      mbyte.c - but there is no trace of cp1251 but with this code page gvim
      works perfectly)

      Or may be my iconv.dll is wrong?
      Where did you folks get 'right' iconv.dll for windows?

      --
      Igor.
      mailto:igor@...
    • Bram Moolenaar
      ... I don t know why this happens. Vim does use the active codepage as the default encoding (this is done in the file mbyte.c, enc_locale() function). Vim may
      Message 2 of 2 , Dec 16, 2003
      • 0 Attachment
        Igor Prischepoff wrote:

        > Win2k russian,MS-Windows 32 bit console vim 6.2 standard (no patches)
        > c:> chcp
        > current code page 866
        > c:>vim -u NONE -U NONE
        > :set enc?
        > encoding=cp1251
        > ^^^^^^^^^^^^^^^^^^
        > why is that so?
        > 'chcp' shows that my current code page is cp866

        I don't know why this happens. Vim does use the active codepage as the
        default encoding (this is done in the file mbyte.c, enc_locale() function).

        Vim may fall back to using latin1, but using cp1251 is weird. I don't
        have an explanation for that. Maybe that is the default codepage used
        by your system?

        > ok, let's set it manually:
        >
        > :set enc=cp866
        > :set tenc=cp866
        > :set fenc=cp866
        >
        > Now i'm trying to enter some national chars (in cp866 codepage)-
        > everything is ok. They got displayed correctly, saved correctly
        > but i can not uppercase them,nor move to word boundaries with
        > w,W,b,B commands.
        > If i select some text in visual mode and then hit U
        > they gets distorted but not uppercased.

        Vim uses the standard C functions for upper/lower case characters.
        These should react to the current locale setting, but it may depend on
        the compiler used. Which Vim version are you using?

        A solution may be to set the 'encoding' to "utf8" and 'fileencoding' to
        "cp866". But that may cause other problems.

        > I've looked into mbyte.c file and there is no such codepage defined.
        > Does it means that cp866 didn't supported by vim?

        Vim should support all working codepages under Win32. The number does
        not need to be recognized by the source code.

        > But there is cp1255,cp932,cp949 etc...
        > Should i define somehow my codepage and stuck it there?

        The names mentioned are for supporting alias names.

        > I'd like to fix it myself if possible,but i need some help.
        > I've got sources and like to know in which file to look.
        > Where code, which handles visual mode 'U' (UPPERCASE'ing) command and
        > settting codepage on startup, is located.

        Search for TOUPPER_LOC in the code to find relevant parts. It might not
        be easy to locate the relevant code though. You might want to try out
        what the toupper() and tolower() functions do with characters in your
        encoding.

        > Or may be my iconv.dll is wrong?
        > Where did you folks get 'right' iconv.dll for windows?

        For the functionality you mention iconv.dll is not used.

        --
        Everybody lies, but it doesn't matter since nobody listens.
        -- Lieberman's Law

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
        \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
        \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
      Your message has been successfully submitted and would be delivered to recipients shortly.