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

Unicode on Mac OSX

Expand Messages
  • Nickolay Kolev
    Hi all, I have set encoding=utf-8 in both my .vimrc and my .gvimrc. And still whenever I create a file, be it in the Terminal (which has it s encoding to UTF-8
    Message 1 of 3 , Dec 1, 2003
    • 0 Attachment
      Hi all,

      I have

      set encoding=utf-8

      in both my .vimrc and my .gvimrc. And still whenever I create a file,
      be it in the Terminal (which has it's encoding to UTF-8 as well) or in
      the Vim.app I have compiled myself, the file is either ASCII or NON-ISO
      ASCII (depending on the symbols I use in it). This is according to the
      file command. iconv complains it cannot convert these files.

      Any ideas what might be wrong?

      Many thanks in advance,
      Nicky
    • Antoine J. Mechelynck
      ... encoding defines how (g)vim represents your data internally fileencoding says how (Vim thinks that) the file is encoded on disk. It has a local value
      Message 2 of 3 , Dec 1, 2003
      • 0 Attachment
        Nickolay Kolev <nmkolev@...> wrote:
        > Hi all,
        >
        > I have
        >
        > set encoding=utf-8
        >
        > in both my .vimrc and my .gvimrc. And still whenever I create a file,
        > be it in the Terminal (which has it's encoding to UTF-8 as well) or in
        > the Vim.app I have compiled myself, the file is either ASCII or
        > NON-ISO ASCII (depending on the symbols I use in it). This is
        > according to the file command. iconv complains it cannot convert
        > these files.
        >
        > Any ideas what might be wrong?
        >
        > Many thanks in advance,
        > Nicky

        'encoding' defines how (g)vim represents your data internally

        'fileencoding' says how (Vim thinks that) the file is encoded on disk. It
        has a local value for each buffer, and also a global value used to set the
        local one whenever you create a new file.

        'fileencodings' (with s) defines the heuristics used by (g)vim to set the
        'fileencoding' (without s) when reading an existing file. Note that if there
        is at least one single-byte encoding in 'fileencodings', anything following
        it is never used (so if there are more than one, only the first one is ever
        used).

        'termencoding' tells (g)vim how your keyboard represents the data you type.
        It also tells console Vim (but not gvim) how the data must be encoded to be
        properly represented onscreen. (gvim can show anything onscreen if your
        'guifont' has the glyphs for it).

        See
        :help 'encoding'
        :help 'fileencoding'
        :help 'fileencodings'
        :help 'termencoding'
        :help 'guifont'
        :help 'bomb'
        :help ++opt
        :help :set
        :help :setlocal
        :help :setglobal

        and also the following info about UTF-8 and Unicode in general, as used by
        Vim (mostly by gvim):

        :help Unicode

        http://vimdoc.sourceforge.net/cgi-bin/vimfaq2html3.pl#35.1 and the rest
        of section 35 too

        http://vim.sourceforge.net/tips/tip.php?tip_id=246 (which presents more
        or less the same info as in section 35 of the FAQ, arranged a little
        differently)

        http://vim.sourceforge.net/scripts/script.php?script_id=789
        (set_utf8.vim), a scriptlet built around what to change in which sequence to
        switch over cleanly to UTF-8 from whatever national encoding gvim finds at
        startup (and would keep if there were no vimrc and no gvimrc to tell it
        otherwise). Experience has told me that forgetting one apparently
        insignificant detail can sometimes lead to disaster. In particular, ":set
        encoding=utf8" usually has lots of disastrous side-effects if used alone;
        proper measures have to be taken to make it all work harmoniously together.

        ...and if you look at the above-mentioned tip, if you download the
        above-mentioned script, and have an opinion about them, don't forget to vote
        for them (or maybe against them) at vim-online.

        HTH,
        Tony.
      • Benji Fisher
        ... IIUC, the problem used to be that Apple did not supply iconv. It seems that, with OS X.iii, this has changed. Nonetheless, vim seems to compile without
        Message 3 of 3 , Dec 2, 2003
        • 0 Attachment
          On Mon, Dec 01, 2003 at 11:49:54PM +0100, Nickolay Kolev wrote:
          > Hi all,
          >
          > I have
          >
          > set encoding=utf-8
          >
          > in both my .vimrc and my .gvimrc. And still whenever I create a file,
          > be it in the Terminal (which has it's encoding to UTF-8 as well) or in
          > the Vim.app I have compiled myself, the file is either ASCII or NON-ISO
          > ASCII (depending on the symbols I use in it). This is according to the
          > file command. iconv complains it cannot convert these files.
          >
          > Any ideas what might be wrong?
          >
          > Many thanks in advance,
          > Nicky

          IIUC, the problem used to be that Apple did not supply iconv. It
          seems that, with OS X.iii, this has changed. Nonetheless, vim seems to
          compile without iconv support. Maybe there is a problem with the
          configure script. Check the output of

          :version

          for +iconv or -iconv. If, as I think, this is a Mac-specific problem,
          and you want to continue the discussion, I suggest moving it to the
          vim-mac list.

          HTH --Benji Fisher
        Your message has been successfully submitted and would be delivered to recipients shortly.