To: vim_dev@googlegroups.com Subject: Patch 8.2.2915 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2915 Problem: MS-Windows: when using "default" for encoding utf-8 is used. Solution: Use the system encoding. (Ken Takata, closes #8300) Files: src/mbyte.c, runtime/doc/options.txt *** ../vim-8.2.2914/src/mbyte.c 2021-05-30 18:04:14.710468943 +0200 --- src/mbyte.c 2021-05-31 18:37:53.509205924 +0200 *************** *** 4453,4460 **** --- 4453,4465 ---- 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(). r = get_encoding_default(); + #endif if (r == NULL) r = (char_u *)ENC_DFLT; return vim_strsave(r); *** ../vim-8.2.2914/runtime/doc/options.txt 2021-05-30 18:04:14.710468943 +0200 --- runtime/doc/options.txt 2021-05-31 18:39:44.824949239 +0200 *************** *** 3112,3120 **** because Vim cannot detect an error, thus the encoding is always accepted. The special value "default" can be used for the encoding from the ! environment. This is the default value for 'encoding'. It is useful ! when '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 sequence it won't be recognized as UTF-8. You can use the |8g8| command to find the illegal byte sequence. --- 3116,3125 ---- because Vim cannot detect an error, thus the encoding is always accepted. The special value "default" can be used for the encoding from the ! environment. On MS-Windows this is the system encoding. Otherwise ! this is the default value for 'encoding'. It is useful when ! '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 sequence it won't be recognized as UTF-8. You can use the |8g8| command to find the illegal byte sequence. *** ../vim-8.2.2914/src/version.c 2021-05-30 22:17:21.039457542 +0200 --- src/version.c 2021-05-31 18:38:57.789058603 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2915, /**/ -- A hamburger walks into a bar, and the bartender says: "I'm sorry, but we don't serve food here." /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///