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

Re: Win32 clipboard and pasting unicode from other apps

Expand Messages
  • Bram Moolenaar
    ... I ll do that in a separate message. ... Aha. I suppose that when requesting CF_UNICODETEXT it doesn t convert from CF_TEXT, thus when obtaining the
    Message 1 of 32 , Feb 5, 2003
    View Source
    • 0 Attachment
      Glenn Maynard wrote:

      > My "patch" doesn't like this patch. Could you attach it, instead of
      > putting it inline in the mail? (Not sure where the problem comes from;
      > I'm using Mutt and a standard-issue patch(1) ...)

      I'll do that in a separate message.

      > On Sun, Feb 02, 2003 at 06:24:17PM +0100, Bram Moolenaar wrote:
      > > ! /*
      > > ! * Open the clipboard, clear it and put our text on it.
      > > ! * Always set our Vim format. Either put Unicode or plain text on it.
      > > ! * TODO: why not both?
      >
      > The docs for the clipboard claim, at least, that it'll convert
      > CF_UNICODETEXT to CF_TEXT if the former is set and the latter is
      > requested. The documentation appears to be correct in 2k, at least;
      > it claims to be applicable down to 95. (I havn't tested it below 2k;
      > I'll try to test it on the local 98 machine.)

      Aha. I suppose that when requesting CF_UNICODETEXT it doesn't convert
      from CF_TEXT, thus when obtaining the clipboard contents we do have to
      check both.

      > > But let's first check if the clipboard Unicode support works well.
      > > Especially using iconv() for conversions.
      >
      > It should use the Windows functions for all codepages. This was in the
      > original patch, but it requires the enc_codepage code which is separate,
      > so I changed it to enc_dbcs for now. If you get around to the patch to
      > handle enc_codepage, just swap in enc_codepage in penc_to_ucs2 and
      > ucs2_to_enc.

      I can't find the right patch for enc_codepage right now. All this was
      postponed much too long...

      Can you check the changes for enc_codepage and send me a patch again?
      Preferably against the current version with the Unicode clipboard patch
      included.

      > The only potential problem I see (beyond the above) is if people are using
      > the close-but-not-quite encodings, eg. ISO-8859-1 when they mean CP1252. In
      > this case, there'll be problems in conversion. The only fix to this is to
      > tell them to use the correct name, as this is the correct behavior--I
      > don't *want* my editor to silently "work" in this case; it might result,
      > for example, in me sending off CP1252 files (using its non-ISO-8859-1
      > quote characters, perhaps) to hapless Unix users who will see garbage.

      I believe it will still work OK when pasting between two Vims with the
      same wrong setting, but not in any other situation. We discussed this
      previously and accepted this drawback. Mostly the active codepage is
      automatically used and everything should be just fine.

      I'm actually more worried about plain mistakes in the code. I did some
      cleaning up and could not test it all.

      --
      Birthdays are healthy. The more you have them, the longer you live.

      /// 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 at Amazon -- http://ICCF.nl/click1.html ///
    • Bram Moolenaar
      ... That has a catch 42 problem: I would like to test the whole thing before sending the patch into the world. ... I didn t change the way it handles the
      Message 32 of 32 , Feb 6, 2003
      View Source
      • 0 Attachment
        Glenn Maynard wrote:

        > > Can you check the changes for enc_codepage and send me a patch again?
        > > Preferably against the current version with the Unicode clipboard patch
        > > included.
        >
        > I'll run over it and send it again. It'd be easiest if you could commit
        > the clipboard patch to CVS, so I can diff from there.

        That has a catch 42 problem: I would like to test the whole thing before
        sending the patch into the world.

        > > I'm actually more worried about plain mistakes in the code. I did some
        > > cleaning up and could not test it all.
        >
        > I got it to apply (along with the strlen fix), and it's worked in a few
        > cursory tests (copying and pasting JP text with enc=utf-8 and enc=cp932).
        > I suspect you'll want more testing in 9x, which I can't do here ...

        I didn't change the way it handles the clipboard. It's mostly the
        various conversions that need to be checked, including iconv().

        --
        hundred-and-one symptoms of being an internet addict:
        156. You forget your friend's name but not her e-mail address.

        /// 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 at Amazon -- http://ICCF.nl/click1.html ///
      Your message has been successfully submitted and would be delivered to recipients shortly.