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

Patch for Windows 95/98 to try out

Expand Messages
  • Bram Moolenaar
    There have been a few complaints that input for languages other than latin1 does not work properly on Windows 95/98. What changed is that Vim now assumes that
    Message 1 of 3 , Dec 5, 2004
    • 0 Attachment
      There have been a few complaints that input for languages other than
      latin1 does not work properly on Windows 95/98. What changed is that
      Vim now assumes that the characters are in UCS-2. This appears to work
      fine for Windows NT/XP. I guess that the MSDN documentation is wrong,
      and for the older windows systems Vim actually gets the character in the
      current codepage.

      The patch below should fix this. Please try it out if you have Windows
      95/98 and use a language like Russian. Let me know if it works or not.
      Then I'll release it officially.


      *** ../vim-6.3.041/src/gui_w48.c Sat Dec 4 17:23:22 2004
      --- src/gui_w48.c Sun Dec 5 19:34:54 2004
      ***************
      *** 488,514 ****
      WCHAR wstring[2];
      char_u *ws = NULL;;

      ! /* "ch" is a UTF-16 character. Convert it to a string of bytes. When
      ! * "enc_codepage" is non-zero use the standard Win32 function, otherwise
      ! * use our own conversion function (e.g., for UTF-8). */
      ! wstring[0] = ch;
      ! if (enc_codepage > 0)
      ! len = WideCharToMultiByte(enc_codepage, 0, wstring, 1, string, slen,
      ! 0, NULL);
      else
      {
      len = 1;
      ! ws = ucs2_to_enc(wstring, &len);
      ! if (ws == NULL)
      ! len = 0;
      else
      {
      ! if (len > slen) /* just in case */
      ! len = slen;
      ! mch_memmove(string, ws, len);
      ! vim_free(ws);
      }
      }
      if (len == 0)
      #endif
      {
      --- 488,536 ----
      WCHAR wstring[2];
      char_u *ws = NULL;;

      ! if (os_version.dwPlatformId != VER_PLATFORM_WIN32_NT)
      ! {
      ! /* On Windows 95/98 we apparently get the character in the active
      ! * codepage, not in UCS-2. If conversion is needed convert it to
      ! * UCS-2 first. */
      ! if ((int)GetACP() == enc_codepage)
      ! len = 0; /* no conversion required */
      ! else
      ! {
      ! string[0] = ch;
      ! len = MultiByteToWideChar(GetACP(), 0, string, 1, wstring, 2);
      ! }
      ! }
      else
      {
      + wstring[0] = ch;
      len = 1;
      ! }
      !
      ! if (len > 0)
      ! {
      ! /* "ch" is a UTF-16 character. Convert it to a string of bytes. When
      ! * "enc_codepage" is non-zero use the standard Win32 function,
      ! * otherwise use our own conversion function (e.g., for UTF-8). */
      ! if (enc_codepage > 0)
      ! len = WideCharToMultiByte(enc_codepage, 0, wstring, len,
      ! string, slen, 0, NULL);
      else
      {
      ! len = 1;
      ! ws = ucs2_to_enc(wstring, &len);
      ! if (ws == NULL)
      ! len = 0;
      ! else
      ! {
      ! if (len > slen) /* just in case */
      ! len = slen;
      ! mch_memmove(string, ws, len);
      ! vim_free(ws);
      ! }
      }
      }
      +
      if (len == 0)
      #endif
      {


      --
      You can test a person's importance in the organization by asking how much RAM
      his computer has. Anybody who knows the answer to that question is not a
      decision-maker.
      (Scott Adams - The Dilbert principle)

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
    • Mikolaj Machowski
      ... Hello, I d like to test it but don t have ability to compile on Windows. So, if someone could provide exe I would be grateful :) m. -- LaTeX + Vim =
      Message 2 of 3 , Dec 5, 2004
      • 0 Attachment
        Dnia niedziela, 5 grudnia 2004 19:47, Bram Moolenaar napisał:
        > There have been a few complaints that input for languages other than
        > latin1 does not work properly on Windows 95/98. What changed is that
        > Vim now assumes that the characters are in UCS-2. This appears to work
        > fine for Windows NT/XP. I guess that the MSDN documentation is wrong,
        > and for the older windows systems Vim actually gets the character in the
        > current codepage.
        >
        > The patch below should fix this. Please try it out if you have Windows
        > 95/98 and use a language like Russian. Let me know if it works or not.
        > Then I'll release it officially.

        Hello,

        I'd like to test it but don't have ability to compile on Windows. So, if
        someone could provide exe I would be grateful :)

        m.


        --
        LaTeX + Vim = http://vim-latex.sourceforge.net/
        Vim-list(s) Users Map: (last change 6 Oct)
        http://skawina.eu.org/mikolaj/vimlist
        CLEWN - http://clewn.sf.net
      • Antoine J. Mechelynck
        ... I m not on 98 anymore so I can t test it myself. However, compiling Vim on Windows is nor really hard; see
        Message 3 of 3 , Dec 5, 2004
        • 0 Attachment
          On 5/12/2004 23:12, Mikolaj Machowski wrote:
          > Dnia niedziela, 5 grudnia 2004 19:47, Bram Moolenaar napisał:
          >
          >>There have been a few complaints that input for languages other than
          >>latin1 does not work properly on Windows 95/98. What changed is that
          >>Vim now assumes that the characters are in UCS-2. This appears to work
          >>fine for Windows NT/XP. I guess that the MSDN documentation is wrong,
          >>and for the older windows systems Vim actually gets the character in the
          >>current codepage.
          >>
          >>The patch below should fix this. Please try it out if you have Windows
          >>95/98 and use a language like Russian. Let me know if it works or not.
          >>Then I'll release it officially.
          >
          >
          > Hello,
          >
          > I'd like to test it but don't have ability to compile on Windows. So, if
          > someone could provide exe I would be grateful :)
          >
          > m.
          >
          >
          I'm not on 98 anymore so I can't test it myself. However, compiling Vim
          on Windows is nor really hard; see
          http://users.skynet.be/antoine.mechelynck/vim/compile.htm for a HowTo page.

          HTH,
          Tony.
        Your message has been successfully submitted and would be delivered to recipients shortly.