Skip to content

Commit ef8706f

Browse files
k-takatabrammool
authored andcommitted
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)
1 parent 2fa9384 commit ef8706f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

runtime/doc/options.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3116,9 +3116,10 @@ A jump table for the options with a short description can be found at |Q_op|.
31163116
because Vim cannot detect an error, thus the encoding is always
31173117
accepted.
31183118
The special value "default" can be used for the encoding from the
3119-
environment. This is the default value for 'encoding'. It is useful
3120-
when 'encoding' is set to "utf-8" and your environment uses a
3121-
non-latin1 encoding, such as Russian.
3119+
environment. On MS-Windows this is the system encoding. Otherwise
3120+
this is the default value for 'encoding'. It is useful when
3121+
'encoding' is set to "utf-8" and your environment uses a non-latin1
3122+
encoding, such as Russian.
31223123
When 'encoding' is "utf-8" and a file contains an illegal byte
31233124
sequence it won't be recognized as UTF-8. You can use the |8g8|
31243125
command to find the illegal byte sequence.

src/mbyte.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4453,8 +4453,13 @@ enc_canonize(char_u *enc)
44534453

44544454
if (STRCMP(enc, "default") == 0)
44554455
{
4456+
#ifdef MSWIN
4457+
// Use the system encoding, the default is always utf-8.
4458+
r = enc_locale();
4459+
#else
44564460
// Use the default encoding as it's found by set_init_1().
44574461
r = get_encoding_default();
4462+
#endif
44584463
if (r == NULL)
44594464
r = (char_u *)ENC_DFLT;
44604465
return vim_strsave(r);

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
2915,
753755
/**/
754756
2914,
755757
/**/

0 commit comments

Comments
 (0)