0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2912: MS-Windows: most users expect using Unicode

Problem:    MS-Windows: most users expect using Unicode.
Solution:   Default 'encoding' to utf-8 on MS-Windows. (Ken Takata,
            closes #3907)
This commit is contained in:
K.Takata
2021-05-30 18:04:19 +02:00
committed by Bram Moolenaar
parent e71c0ebe2c
commit f883d9027c
6 changed files with 19 additions and 5 deletions

View File

@@ -430,14 +430,21 @@ set_init_1(int clean_arg)
# endif
# endif
# ifdef MSWIN
// MS-Windows has builtin support for conversion to and from Unicode, using
// "utf-8" for 'encoding' should work best for most users.
p = vim_strsave((char_u *)ENC_DFLT);
# else
// enc_locale() will try to find the encoding of the current locale.
// This works best for properly configured systems, old and new.
p = enc_locale();
# endif
if (p != NULL)
{
char_u *save_enc;
// Try setting 'encoding' and check if the value is valid.
// If not, go back to the default "latin1".
// If not, go back to the default encoding.
save_enc = p_enc;
p_enc = p;
if (STRCMP(p_enc, "gb18030") == 0)