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

Re: Document encoding autodetection

Expand Messages
  • Karel Polak
    From: DukO Date: Mon, 1 December 2003 ( 2:00 PM) Hello, I m not absolutely sure, but I think that it is impossible to distinguish between
    Message 1 of 3 , Dec 1, 2003
    • 0 Attachment
      From: DukO <duko@...>
      Date: Mon, 1 December 2003 ( 2:00 PM)

      Hello,

      I'm not absolutely sure, but I think that it is impossible to
      distinguish between ISO-8859-2 and CP1250 encodings because they are
      different only in two chars. It means that the only way you can use is
      :e ++enc=cp1250 <filename>

      With best regards

      KOdlik

      > Hello all,
      >
      > I'm running RH9 machine with UTF-8 encoding as the "core" one.
      > Time to time I'm editing documents in ISO-8859-2 and CP-1250
      > encoding. To make my life easier, I've put into my .vimrc file
      > the following line:
      >
      > set fileencodings=utf-8,iso-8859-2,cp1250,latin1
      >
      > Well, but it doesn't work as I can't see properly some characters.
      > Probably the autodetection fails or selects wrong encoding.
      >
      > Nevertheless, if I let the .vimrc file like:
      >
      > set fileencodings=utf-8,latin1
      >
      > and use command:
      >
      > e ++enc=cp1250 <filename>
      >
      > then it works OK, but it is too clumsy. Is there any way out?
      >
      > Thanks,
      >
      > Dusan Kolar
      >
      >
      >
    • Antoine J. Mechelynck
      ... ISO-8859-2, cp1250 and latin1 are 3 different 8-bit encodings. Since there is no possible failure for detecting an 8-bit encoding via the fileencodings
      Message 2 of 3 , Dec 1, 2003
      • 0 Attachment
        DukO <duko@...> wrote:
        > Hello all,
        >
        > I'm running RH9 machine with UTF-8 encoding as the "core" one.
        > Time to time I'm editing documents in ISO-8859-2 and CP-1250
        > encoding. To make my life easier, I've put into my .vimrc file
        > the following line:
        >
        > set fileencodings=utf-8,iso-8859-2,cp1250,latin1
        >
        > Well, but it doesn't work as I can't see properly some characters.
        > Probably the autodetection fails or selects wrong encoding.
        >
        > Nevertheless, if I let the .vimrc file like:
        >
        > set fileencodings=utf-8,latin1
        >
        > and use command:
        >
        > e ++enc=cp1250 <filename>
        >
        > then it works OK, but it is too clumsy. Is there any way out?
        >
        > Thanks,
        >
        > Dusan Kolar

        ISO-8859-2, cp1250 and latin1 are 3 different 8-bit encodings. Since there
        is no possible "failure" for detecting an 8-bit encoding via the
        'fileencodings' option, it is not possible to autodetect more than one of
        them. Your 'fileencodings' will never autodetect cp1250 or latin1 because of
        this limitation. But if you use ++enc with the proper encoding, it should
        work, as you noted.

        See
        :help 'fileencodings'

        and scroll down to WRONG VALUES: (a forward search on WRONG might help).

        Removing and adding encodings with something like

        :set fencs-=iso-8859-2
        :set fencs-=cp1250
        :set fencs-=latin1
        :set fencs+=cp1250

        changing the last line as necessary, would IMHO be even more clumsy, unless
        you had a whole bunch of files to edit sharing the same encoding.

        Regards,
        Tony.
      Your message has been successfully submitted and would be delivered to recipients shortly.