0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.2915: MS-Windows: when using "default" for encoding utf-8 is used

Problem:    MS-Windows: when using "default" for encoding utf-8 is used.
Solution:   Use the system encoding. (Ken Takata, closes #8300)
This commit is contained in:
K.Takata
2021-05-31 18:40:49 +02:00
committed by Bram Moolenaar
parent 2fa9384ca1
commit ef8706fb84
3 changed files with 11 additions and 3 deletions

View File

@@ -3116,9 +3116,10 @@ A jump table for the options with a short description can be found at |Q_op|.
because Vim cannot detect an error, thus the encoding is always because Vim cannot detect an error, thus the encoding is always
accepted. accepted.
The special value "default" can be used for the encoding from the The special value "default" can be used for the encoding from the
environment. This is the default value for 'encoding'. It is useful environment. On MS-Windows this is the system encoding. Otherwise
when 'encoding' is set to "utf-8" and your environment uses a this is the default value for 'encoding'. It is useful when
non-latin1 encoding, such as Russian. 'encoding' is set to "utf-8" and your environment uses a non-latin1
encoding, such as Russian.
When 'encoding' is "utf-8" and a file contains an illegal byte When 'encoding' is "utf-8" and a file contains an illegal byte
sequence it won't be recognized as UTF-8. You can use the |8g8| sequence it won't be recognized as UTF-8. You can use the |8g8|
command to find the illegal byte sequence. command to find the illegal byte sequence.

View File

@@ -4453,8 +4453,13 @@ enc_canonize(char_u *enc)
if (STRCMP(enc, "default") == 0) if (STRCMP(enc, "default") == 0)
{ {
#ifdef MSWIN
// Use the system encoding, the default is always utf-8.
r = enc_locale();
#else
// Use the default encoding as it's found by set_init_1(). // Use the default encoding as it's found by set_init_1().
r = get_encoding_default(); r = get_encoding_default();
#endif
if (r == NULL) if (r == NULL)
r = (char_u *)ENC_DFLT; r = (char_u *)ENC_DFLT;
return vim_strsave(r); return vim_strsave(r);

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2915,
/**/ /**/
2914, 2914,
/**/ /**/