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

Re: gvim crash when using UTF-8 locale and paste text from Windows clipboard

Expand Messages
  • Bram Moolenaar
    ... The problem may be that there is a % character in the second byte of one of the Chinese double-byte characters. sprintf() then may see the wrong
    Message 1 of 10 , Sep 22, 2005
    • 0 Attachment
      Rainux wrote:

      > I'm sorry for some personal reason I've left some days.
      >
      > > {
      > > char *ts =3D _("%ld more lines");
      > > sprintf((char *)msg_buf, ts, pn);
      > > }
      > >
      > > If it now crashes in sprintf() then it's a different problem. But from
      > > your description it should crash in _().
      >
      > I did this, and it crash in sprintf(), seems the problem is in msvcrt.dll.
      >
      > I use Borland C++ 5.5.1 for Win32 compile Vim just now(previously I
      > use Cygwin's gcc), and found the new gvim.exe's import table don't
      > have msvcrt.dll. And, this build of gvim never crashes in zh_CN.UTF-8.
      > So I think the problem should in msvcrt.dll(Bram use MSVC compile Vim,
      > so the "official build" rely on msvcrt.dll).

      The problem may be that there is a % character in the second byte of one
      of the Chinese double-byte characters. sprintf() then may see the wrong
      arguments.

      Another possibility is that msg_buf is too small. I made it longer a
      short while ago. Currently it's 480 bytes. In Vim 6.3 the value was
      80. Patch 6.3.072 changed it to 240. If you are still using 80 then
      this is probably the cause of the trouble.

      --
      "Hegel was right when he said that we learn from history that man can
      never learn anything from history." (George Bernard Shaw)

      /// 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 ///
    • Bram Moolenaar
      Rainux - ... I plan to switch to the free compiler that MS distributes. But I need to make sure there are no legal problems and find a way to debug the
      Message 2 of 10 , Nov 23, 2005
      • 0 Attachment
        Rainux -

        > Hi Bram, recently I use MSVC 6.0 to compile Vim, and found Vim 6.4
        > will not crash when try to display some UTF-8 encoded Chinese message.
        > Both GCC 3.4.4 in Cygwin and MSVC 5.0 (you use it compile the
        > "official build", don't you?) compiled Vim 6.4 will crash on this
        > case.
        >
        > But Vim 7.0aa already fixed this "bug" (I've tested above version
        > 7.0149), use GCC to compile is OK. And, Vim 7 can correctly hand the
        > Chinese file name on zh_CN.UTF-8 locale now. (Vim 6.4 can't)
        >
        > So, I want to suggest you use the recent version of MSVC to compile
        > the "official build" if possible, thanks.

        I plan to switch to the free compiler that MS distributes. But I need
        to make sure there are no legal problems and find a way to debug the
        resulting program.

        - Bram

        --
        "Hit any key to continue" it said, but nothing happened after F sharp.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://www.ICCF.nl ///
      • Rainux
        The free Visual C++ Toolkit 2003 do not contain platform SDK, therefor, you should get the newer .lib and .h files another way ;) I ve used Visual C++ 2003
        Message 3 of 10 , Nov 23, 2005
        • 0 Attachment
          The free Visual C++ Toolkit 2003 do not contain platform SDK,
          therefor, you should get the newer .lib and .h files another way ;)

          I've used Visual C++ 2003 (the compiler and the one in the Visual C++
          Toolkit 2003 is just the same) to compile Vim for some days, and it
          seems work fine.

          Gdb can be used as debugger in Win32 too.

          2005/11/23, Bram Moolenaar <Bram@...>:
          >
          > I plan to switch to the free compiler that MS distributes. But I need
          > to make sure there are no legal problems and find a way to debug the
          > resulting program.
          >
          > - Bram
          >
          > --
          > "Hit any key to continue" it said, but nothing happened after F sharp.
          >
          > /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          > \\\ download, build and distribute -- http://www.A-A-P.org ///
          > \\\ help me help AIDS victims -- http://www.ICCF.nl ///
          >


          --
          Goddess light my path!
        Your message has been successfully submitted and would be delivered to recipients shortly.