With Vim's current behavior, 'encoding' is derived from the environment and 'fileencoding'/'termencoding' derive from 'encoding' (modulo 'fileencodings' affect on 'fenc'). This seems sub-optimal for various reasons.
1) Vim is using an internal encoding derived from the environment which
may or may not be able to represent the different file encodings
encountered when editing various files.
2) The encoding Vim uses for interpreting input from the user and
determining how to display to the user is not directly derived from
the user's environment.
3) File encoding detection ('fencs') defaults to a value that is
unlikely to correctly work with most interesting (non-ascii) files.
Defaulting 'enc' to UTF-8 helps address these problems.
1) This is now a non-issue as Vim can internally represent all
characters by converting them to their unicode counterpart.
2) This can be addressed by making 'tenc' derive its value from the
environment instead of from 'enc', which is more in line with the
behavior implied by the name.
3) File encoding detection now has a sane default value which means new
users are less likely to encounter problems when editing files of
various encodings.
This change would also allow eliminating 'encoding' as an option or,
less drastic, disallowing changing 'enc' once the startup files have
been sourced.
Changing 'enc' in a running Vim session is a very common mistake to new
Vim users that are trying to get their file written out in a specific
encoding or editing a file that's not in their environment's encoding.
The help already states that changing 'enc' in a running session is a
bad idea, and I know from experience that it can cause Vim to crash[0].
Taking the next logical step and preventing users from doing that
(unless someone can provide a compelling reason to continue allowing it)
makes sense and helps prevent potential data loss.
--
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
[0] vim -u NONE --cmd 'set enc=utf8 list' -c 'let &lcs="nbsp:".nr2char("8215")'
:put =nr2char("160")
:set enc=latin1
signature.asc
Description: Digital signature
