Sunday, September 10, 2017

Re: Encoding issues with Windows gvim

On Sunday, September 10, 2017 at 12:28:12 AM UTC-6, Tony Mechelynck wrote:
> Despite its name, ++enc sets 'fileencoding' (telling Vim which charset
> is used _on disk_ for that file), not 'encoding' (the charset used for
> the data _in Vim memory_); the latter, if you don't change it, is
> still set to latin1, which has no representation for Greek letters.
>
> When you did ":set enc=utf-16le", Vim actually used utf-8, because
> UTF-16le uses a lot of null bytes (one each for every codepoint not
> greater than U+00FF, for instance spaces, tabs, commas, etc.) and Vim
> uses C strings, which those null bytes would terminate. UTF-8, like
> UTF-16, can represent data in any encoding including the Greek text of
> your problematic file. Your Linux Vim probably runs in a UTF-8 locale
> (something many Linux systems use) which would explain why your Greek
> text was immediately readable on Linux.
>
> But if you change 'encoding' while some file (even maybe just a help
> file) is already loaded in memory, all the data in memory becomes
> invalid. The only safe place to change 'encoding' is near the top of
> your vimrc, before any editfile has been read, and there are other
> changes that go with it.
>
> Please read the Vim wiki article linked in my previous post, it will
> tell you how to do it safely, and explain in detail the differences
> between the various encoding-related options that Vim possesses.

Seems I missed some vital points that I now understand.
Thanks for the patience Tony.

--
--
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.
For more options, visit https://groups.google.com/d/optout.

No comments: