Thursday, December 10, 2020

Re: Setting file encoding in a modeline

On Thu, 10 Dec 2020 at 13:43, Christian Brabandt <cblists@256bit.org> wrote:
>
>
> On Do, 10 Dez 2020, A. Wik wrote:
>
> > It seems to me that a modeline would be a convenient place to set the
> > encoding used for a file. However, while it does set 'fenc'
> > accordingly, the file is not loaded and displayed according to this
> > setting.
> >
> > Bram said reading is tried with each encoding in fencs until one
> > succeeds. Why not reload the file with the correct encoding once a
> > modeline with a fenc setting has been read?
>
> The problem with this is, it is a catch 22. To be able to handle the
> modeline, Vim must have already read correctly the buffer with the
> correct encoding.
>
> So if it was wrong, the modeline could not be read correctly and
> therefore this doesn't help.

I see, but let's assume there is a "latin1" in 'fencs', and Vim reads
the file as if it is in this encoding, and successfully decodes a
modeline that says "fenc=cp437", and sets the 'fenc' accordingly, then
why not also do a reload or just a "re-display" based on this setting?

-aw

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALPW7mQav5dDcsxGZHsMZ581zBd4MBG9c11wBa9Lp%2BV2nunPRw%40mail.gmail.com.

No comments: