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

Re: Is it possible to set up GVIM to work with multiple file encodings? (I can not)

Expand Messages
  • Glenn Maynard
    ... I get this, too; pasting non-ASCII text to and from gvim doesn t work for me. In UTF-8, I can t copy á or か to *or* from gvim. In latin1, I can
    Message 1 of 6 , Apr 10, 2002
    • 0 Attachment
      On Mon, Apr 08, 2002 at 10:50:38PM +0400, Valery Kondakoff wrote:
      > when I set up VIM to use 'utf-8' as default encoding it is
      > _impossible_ to copy Russian text from VIM to another Windows
      > application (and vice versa: from another Windows app to VIM).
      > Russian text is pasted as garbage. (There are no problems, when I'm
      > copying Russian text between VIM buffers).
      >
      > What setting controls the encoding of the text in the clipboard?

      I get this, too; pasting non-ASCII text to and from gvim doesn't work
      for me.

      In UTF-8, I can't copy "á" or "か" to *or* from gvim.

      In latin1, I can paste "á" *to* gvim, but *from* gives garbage.

      Strangely, "sjis" doesn't appear to work at all: both pasting, IM'ing
      and reading "か" from a file breaks. (Pasting and IMing result in a
      default "?"; reading results in garbage.) I'm not sure why this is
      happening, but I can't test pasting out of gvim in sjis due to it.

      This happens with UCS2, as well (very strange), but not with UCS4. If I
      already have "か" onscreen, and change to UCS2, it stays (and copying it
      to the clipboard does not work), but if I change to SJIS, it's converted
      to garbage. There's something weird going on.

      By the way, I noticed something else: gvim is defaulting to IME input the
      first time I do a search. (Subsequent searches are fine--back to English
      input--and this doesn't happen with :commands, just /searches.) This has
      been happening a while, I think, but I forgot to investigate it at first
      and I've since apparently habitually worked around it and so completely
      forgot about it. I'll poke at this later; it's probably the same kind
      of problem we dealt with earlier.

      VIM - Vi IMproved 6.1 (2002 Mar 24, compiled Mar 24 2002 16:04:44)
      MS-Windows 32 bit GUI version with OLE support
      Big version with GUI. Features included (+) or not (-):
      +autocmd -balloon_eval +browse ++builtin_terms +byte_offset +cindent
      +clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
      +cryptv -cscope +dialog_gui +diff +digraphs -ebcdic +emacs_tags +eval +ex_extra
      +extra_search +farsi +file_in_path +find_in_path +folding -footer +gettext/dyn
      -hangul_input +iconv/dyn +insert_expand +jumplist +keymap +langmap +libcall
      +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname
      +mouse +mouseshape +multi_byte_ime/dyn +multi_lang +ole -osfiletype +path_extra
      +perl/dyn -postscript +printer +python/dyn +quickfix +rightleft -ruby
      +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax
      +tag_binary +tag_old_static -tag_any_white +tcl/dyn -tgetent -termresponse
      +textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual
      +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
      -xfontset -xim -xterm_save

      Hmm; dynamic iconv loading. Is there any wsy to tell if it's
      successfully loaded it or not? I tried renaming my iconv.dll, loading Vim
      and setting encoding=sjis, and nothing changed, so I'm suspicious that
      it's really loading iconv. (I'd expect that, if it didn't have iconv
      available, it'd not know that "sjis" is a valid encoding, however--"set
      encoding=nothing" does give an error.)

      --
      Glenn Maynard
    • Bram Moolenaar
      ... The Win32 clipboard code in Vim doesn t do conversion of encoding and doesn t indicate what encoding is being used. This suggests something is missing
      Message 2 of 6 , Apr 11, 2002
      • 0 Attachment
        Glenn Maynard wrote:

        > I get this, too; pasting non-ASCII text to and from gvim doesn't work
        > for me.
        >
        > In UTF-8, I can't copy "á" or "か" to *or* from gvim.

        The Win32 clipboard code in Vim doesn't do conversion of encoding and
        doesn't indicate what encoding is being used. This suggests something
        is missing here. Hopefully someone who knows about Win32 clipboard
        stuff can look into this.

        > This happens with UCS2, as well (very strange), but not with UCS4.

        For both encodings Vim uses UTF-8 internally, thus it's strange this
        makes a difference.

        > By the way, I noticed something else: gvim is defaulting to IME input the
        > first time I do a search. (Subsequent searches are fine--back to English
        > input--and this doesn't happen with :commands, just /searches.) This has
        > been happening a while, I think, but I forgot to investigate it at first
        > and I've since apparently habitually worked around it and so completely
        > forgot about it. I'll poke at this later; it's probably the same kind
        > of problem we dealt with earlier.

        Something with the 'imsearch' option?

        --
        hundred-and-one symptoms of being an internet addict:
        157. You fum through a magazine, you first check to see if it has a web
        address.

        /// 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 ///
        \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
      • Valery Kondakoff
        Hello, Bram! ... BM The Win32 clipboard code in Vim doesn t do conversion of encoding and BM doesn t indicate what encoding is being used. This suggests
        Message 3 of 6 , Apr 11, 2002
        • 0 Attachment
          Hello, Bram!

          11 Àïðåëü 2002 ã., you wrote to me:

          >> I get this, too; pasting non-ASCII text to and from gvim doesn't work
          >> for me.

          BM> The Win32 clipboard code in Vim doesn't do conversion of encoding and
          BM> doesn't indicate what encoding is being used. This suggests something
          BM> is missing here. Hopefully someone who knows about Win32 clipboard
          BM> stuff can look into this.

          Thank you for your reply (and one more thank for VIM).

          Excuse me, if I'm wrong, but I was thinking, that the best way to
          solve this issue is to convert win32 clipboard to '&termencoding'
          value.

          So, when I'm setting IM like this:

          let &termencoding = &encoding " this is 'cp1251'
          set encoding=utf-8
          set fileencodings=ucs-bom,cp1251,cp866,koi8-r

          The clipboard will always be converted to the encoding, I'm using for
          _writing_ text.

          What do you think? Is this reasonable? Or am I wrong?

          Please, please, multibyte developers, do somethig with this! :)
          It's almost impossible to use a text editor without an ability to
          exchange text with other apps using clipboard!

          And one more question: why file encoding conversion works properly
          _only_ when 'encoding' is set to 'utf-8'? And after setting 'encoding',
          for example to 'cp1251', I can't convert file encoding for the same
          files, that were successfully converted using 'set encoding=utf-8'?
          Or (maybe) this is a bug?

          Thank you once again!

          --
          Best regards,
          Valery Kondakoff mailto:strauss@...
          http://www.nbk.orc.ru Ne Bey Kopytom
          http://www.nbk.orc.ru/mtb MTB riding in Moscow

          Chip Salzenberg sent me a complete patch to add System V IPC (msg, sem andshm calls), so I added them. If that bothers you, you can always undefinethem in config.sh. :-)
          --Larry Wall

          np: Belly - Untogether (Star)
        • Glenn Maynard
          ... What? Your encoding is wrong, I think. ... I don t think termencoding should do anything when in a GUI. I think that on NT systems, at least, the
          Message 4 of 6 , Apr 11, 2002
          • 0 Attachment
            On Thu, Apr 11, 2002 at 11:29:07PM +0400, Valery Kondakoff wrote:
            > 11 Àïðåëü 2002 ã., you wrote to me:

            What? Your encoding is wrong, I think.

            > Excuse me, if I'm wrong, but I was thinking, that the best way to
            > solve this issue is to convert win32 clipboard to '&termencoding'
            > value.
            >
            > So, when I'm setting IM like this:
            >
            > let &termencoding = &encoding " this is 'cp1251'
            > set encoding=utf-8
            > set fileencodings=ucs-bom,cp1251,cp866,koi8-r
            >
            > The clipboard will always be converted to the encoding, I'm using for
            > _writing_ text.

            I don't think termencoding should do anything when in a GUI. I think
            that on NT systems, at least, the clipboard should *always* be Unicode,
            so there's no loss. I don't know about 9x, though. (I also know little
            about the clipboard; I'll consider checking it out.)

            --
            Glenn Maynard
          • Glenn Maynard
            ... Setting imsearch=0 fixed this. (The oddity of the IME turning off was due to a forgotten IME keybinding I made: ^U in the IME turns it off. I was hitting
            Message 5 of 6 , Apr 12, 2002
            • 0 Attachment
              On Thu, Apr 11, 2002 at 08:22:29PM +0200, Bram Moolenaar wrote:
              > Something with the 'imsearch' option?

              Setting imsearch=0 fixed this. (The oddity of the IME turning off was
              due to a forgotten IME keybinding I made: ^U in the IME turns it off. I
              was hitting ^U in Vim, to clear the IME input, but it was really the IME
              keybinding.)

              I'd suggesting documenting the fact that iminsert and imsearch follow
              the IME status regardless of how it's turned on or off. Most IME2K
              users are likely to use IME bindings to toggle it, not Vim bindings (as
              they're system-wide).

              "Note that this option changes when the input method is toggled
              in Insert mode, such as with CTRL-^ |c_CTRL-^|." (Or something
              clearer.)

              I'd still like to see iminsert (and now imsearch) default to 0 rather
              than 2 when using this IME. (Or, perhaps, default to the state the IME
              was in when Vim loads; that might help to give Vim the same IME behavior
              in input mode as other applications give with other IMEs.)

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