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

Re: MacVim.app - snapshot r300 - available for download

Expand Messages
  • Bram Moolenaar
    ... I would say: If none of the environment variables is defined, then default to utf-8. Someone using a shell might want to set those variables to tell his
    Message 1 of 13 , Oct 2, 2007
    • 0 Attachment
      Tim Allen wrote:

      > I had a look at set_init_1() in options.c, and OMG it's a giant
      > hairball. It looks like the actual auto-detection work is being done
      > by a function called "enc_locale()" in mbyte.c. On Windows, it calls
      > GetACP() which returns the system's default 8-bit encoding (kind of
      > silly if you're on NT which is natively UTF-16), while on POSIX-y
      > platform it checks the LANG and LC_ALL environment variables which are
      > used to configure POSIX locales.
      >
      > I searched for information about what encoding OS X uses natively, but
      > the Apple documentation I found rather uselessly states "Unicode is
      > generally considered the native encoding for Mac OS X and should be
      > used in nearly all situations." (somebody needs to tell them that
      > "Unicode" is not an actual encoding). There is an NSLocale object that
      > has some locale information in it, but "default character set" does
      > not appear to be there.
      >
      > I'd suggest hacking enc_locale() to just say something like "if this
      > is OS X, the encoding should be UTF-8".

      I would say: If none of the environment variables is defined, then
      default to utf-8. Someone using a shell might want to set those
      variables to tell his programs what he prefers.

      --
      "Lisp has all the visual appeal of oatmeal with nail clippings thrown in."
      -- Larry Wall

      /// 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://ICCF-Holland.org ///

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • björn
      ... Ok, I ve changed the procedure in set_init_1() as follows: 1) call enc_locale(). no changes to the enc_locale() code is done...so this (as far as I
      Message 2 of 13 , Oct 8, 2007
      • 0 Attachment
        > > I'd suggest hacking enc_locale() to just say something like "if this
        > > is OS X, the encoding should be UTF-8".
        >
        > I would say: If none of the environment variables is defined, then
        > default to utf-8. Someone using a shell might want to set those
        > variables to tell his programs what he prefers.

        Ok, I've changed the procedure in set_init_1() as follows:

        1) call enc_locale(). no changes to the enc_locale() code is
        done...so this (as far as I understand) checks the "encoding related"
        environment variables.

        2) call mbyte_init() using the encoding returned in 1

        3) if 2 fails then set p_enc to "utf-8" and call mbyte_init() again

        4) if 3 fails then use "latin1" (although 3 should never fail)

        This should permit the user to override the environment variables,
        whilst defaulting to utf-8. Any comments?


        /Björn

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Bram Moolenaar
        ... Ehm, wouldn t it work to change the value of ENC_DFLT in option.h to utf-8 ? With an #ifdef, of course. -- The average life of an organization chart is
        Message 3 of 13 , Oct 9, 2007
        • 0 Attachment
          Bjorn Winckler wrote:

          > > > I'd suggest hacking enc_locale() to just say something like "if this
          > > > is OS X, the encoding should be UTF-8".
          > >
          > > I would say: If none of the environment variables is defined, then
          > > default to utf-8. Someone using a shell might want to set those
          > > variables to tell his programs what he prefers.
          >
          > Ok, I've changed the procedure in set_init_1() as follows:
          >
          > 1) call enc_locale(). no changes to the enc_locale() code is
          > done...so this (as far as I understand) checks the "encoding related"
          > environment variables.
          >
          > 2) call mbyte_init() using the encoding returned in 1
          >
          > 3) if 2 fails then set p_enc to "utf-8" and call mbyte_init() again
          >
          > 4) if 3 fails then use "latin1" (although 3 should never fail)
          >
          > This should permit the user to override the environment variables,
          > whilst defaulting to utf-8. Any comments?

          Ehm, wouldn't it work to change the value of ENC_DFLT in option.h to
          "utf-8"? With an #ifdef, of course.

          --
          The average life of an organization chart is six months. You can safely
          ignore any order from your boss that would take six months to complete.
          (Scott Adams - The Dilbert principle)

          /// 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://ICCF-Holland.org ///

          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • björn
          ... That was the first thing I tried...but then the multibyte stuff does not seem to get initialized, e.g. typing :digraphs shows nothing. Is this because
          Message 4 of 13 , Oct 9, 2007
          • 0 Attachment
            > > > > I'd suggest hacking enc_locale() to just say something like "if this
            > > > > is OS X, the encoding should be UTF-8".
            > > >
            > > > I would say: If none of the environment variables is defined, then
            > > > default to utf-8. Someone using a shell might want to set those
            > > > variables to tell his programs what he prefers.
            > >
            > > Ok, I've changed the procedure in set_init_1() as follows:
            > >
            > > 1) call enc_locale(). no changes to the enc_locale() code is
            > > done...so this (as far as I understand) checks the "encoding related"
            > > environment variables.
            > >
            > > 2) call mbyte_init() using the encoding returned in 1
            > >
            > > 3) if 2 fails then set p_enc to "utf-8" and call mbyte_init() again
            > >
            > > 4) if 3 fails then use "latin1" (although 3 should never fail)
            > >
            > > This should permit the user to override the environment variables,
            > > whilst defaulting to utf-8. Any comments?
            >
            > Ehm, wouldn't it work to change the value of ENC_DFLT in option.h to
            > "utf-8"? With an #ifdef, of course.

            That was the first thing I tried...but then the multibyte stuff does
            not seem to get initialized, e.g. typing :digraphs shows nothing. Is
            this because mbyte_init() never gets called perhaps?


            /Björn

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.