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

Re: UTF8_STRING patch

Expand Messages
  • Bram Moolenaar
    ... Great. I ll try including this patch when I have some time (might be a while...). For the conversion, look in mbyte.c. The functions convert_setup() and
    Message 1 of 6 , Aug 9, 2002
      Jason Maiorana wrote:

      > ok, i got a bit done last night:
      >
      > Here's a patch to the file "gui_gtk_x11.c" that works
      > for me. Im running an old X server, 3.x series, and gtk 1.2,
      > but im confident the patch will also work for newer X/gtk's.
      > The main issue of concern is what will happen when vim is
      > being run in non-utf8 encoding mode. Some sort of
      > "utf8_to_vim_current_encoding" "vim_current_encoding_to_utf8"
      > functions would be needed in "selection_get_event"
      > and "selection_received_event" to complete the support in this
      > case. Bram: any suggestion what function to use to do that?
      >
      >
      > Anyway, when using this patch with encoding=utf8, the results
      > are pretty seamless for me: copying and pasting, highlighting
      > and everything work great with gvim.

      Great. I'll try including this patch when I have some time (might be a
      while...).

      For the conversion, look in mbyte.c. The functions convert_setup() and
      string_convert() should be able to do it.

      --
      "Hit any key to continue" does _not_ mean you can hit the on/off button!

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    • Maiorana, Jason
      ... one quick question: how do you determine which is the appropriate encoding to pass to clip_yank_selection . It looks like the GDK functions all assume
      Message 2 of 6 , Aug 9, 2002
        >For the conversion, look in mbyte.c. The functions convert_setup() and
        >string_convert() should be able to do it.

        one quick question: how do you determine which is the appropriate
        encoding to pass to "clip_yank_selection".

        It looks like the GDK functions all assume that the data is in the
        format
        of the current locale: this is incorrect i think. I set encoding=utf8
        which does not match my en_US locale. I dont have really working locales
        for utf8, if there was an "allLangs_USkbd.utf8" locale i would use it.

        Converting COMPOUND_TEXT to my current locale would only corrupt it,
        which probably explains why that never worked for me. Doesnt vim
        have some notion of internal representation encoding? If vim were
        to always use utf-8 internally in all situations, that would make
        UTF8_STRING conversion a non-issue...
      • Bram Moolenaar
        ... I dunno. You could try looking in the GTK documentation (but you probably end up looking in the source code...). ... The value of encoding defines the
        Message 3 of 6 , Aug 10, 2002
          Jason Maiorana wrote:

          > >For the conversion, look in mbyte.c. The functions convert_setup() and
          > >string_convert() should be able to do it.
          >
          > one quick question: how do you determine which is the appropriate
          > encoding to pass to "clip_yank_selection".
          >
          > It looks like the GDK functions all assume that the data is in the
          > format of the current locale: this is incorrect i think. I set
          > encoding=utf8 which does not match my en_US locale. I dont have
          > really working locales for utf8, if there was an "allLangs_USkbd.utf8"
          > locale i would use it.

          I dunno. You could try looking in the GTK documentation (but you
          probably end up looking in the source code...).

          > Converting COMPOUND_TEXT to my current locale would only corrupt it,
          > which probably explains why that never worked for me. Doesnt vim
          > have some notion of internal representation encoding? If vim were
          > to always use utf-8 internally in all situations, that would make
          > UTF8_STRING conversion a non-issue...

          The value of 'encoding' defines the encoding used internally in Vim for
          all text in buffers, registers, etc.

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

          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
          \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
          \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
        • Maiorana, Jason
          ... Its says in their doc s that gdk_text_property_to_text_list converts from compound text the process s current locale. Vim however needs the text to be
          Message 4 of 6 , Aug 12, 2002
            > > It looks like the GDK functions all assume that the data is in the
            > > format of the current locale: this is incorrect i think.

            >I dunno. You could try looking in the GTK documentation (but you
            >probably end up looking in the source code...).

            Its says in their doc's that "gdk_text_property_to_text_list" converts
            from "compound text" the process's current locale. Vim however needs
            the text to be in option["encoding"] encoding, regardless of the
            current locale. So I think that pasting compound text through gtk
            into a vim where buffer encoding doesnt match locale LC_CTYPE wont work.
            Mostly this is irrelevant because COMPOUND_TEXT is thoroughly deprecated
            imo.

            >> Converting COMPOUND_TEXT to my current locale would only corrupt it,
            >> which probably explains why that never worked for me. Doesnt vim
            >> have some notion of internal representation encoding? If vim were
            >> to always use utf-8 internally in all situations, that would make
            >> UTF8_STRING conversion a non-issue...

            >The value of 'encoding' defines the encoding used internally in Vim for
            >all text in buffers, registers, etc.

            I will look into calling "get_option_value" for the purpose of passing
            to
            "convert_setup".
          • Glenn Maynard
            ... Just pass p_enc. -- Glenn Maynard
            Message 5 of 6 , Aug 12, 2002
              On Mon, Aug 12, 2002 at 03:41:55PM -0400, Maiorana, Jason wrote:
              > >The value of 'encoding' defines the encoding used internally in Vim for
              > >all text in buffers, registers, etc.
              >
              > I will look into calling "get_option_value" for the purpose of passing
              > to
              > "convert_setup".

              Just pass p_enc.

              --
              Glenn Maynard
            Your message has been successfully submitted and would be delivered to recipients shortly.