diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-02-22 12:34:28 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-02-22 12:34:28 +0000 |
commit | 1349bd712cf7d24dc65408c523dd7deb30224f80 (patch) | |
tree | 4169f9aabfde7d4df808d2f9d5c5611d87626379 | |
parent | ca0c1caa36823ea8e61184268d7337e79995352f (diff) |
patch 8.2.4439: accepting "iso8859" 'encoding' as "iso-8859-"v8.2.4439
Problem: Accepting "iso8859" 'encoding' as "iso-8859-".
Solution: use "iso8859" as "iso-8859-1".
-rw-r--r-- | src/mbyte.c | 3 | ||||
-rw-r--r-- | src/testdir/test_options.vim | 25 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/mbyte.c b/src/mbyte.c index 2f4edd53af..78230f65e7 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -318,6 +318,7 @@ enc_alias_table[] = { {"ansi", IDX_LATIN_1}, {"iso-8859-1", IDX_LATIN_1}, + {"iso-8859", IDX_LATIN_1}, {"latin2", IDX_ISO_2}, {"latin3", IDX_ISO_3}, {"latin4", IDX_ISO_4}, @@ -4523,7 +4524,7 @@ enc_canonize(char_u *enc) } // "iso-8859n" -> "iso-8859-n" - if (STRNCMP(p, "iso-8859", 8) == 0 && p[8] != '-') + if (STRNCMP(p, "iso-8859", 8) == 0 && isdigit(p[8])) { STRMOVE(p + 9, p + 8); p[8] = '-'; diff --git a/src/testdir/test_options.vim b/src/testdir/test_options.vim index 2af13d94f4..9ba2ce441e 100644 --- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -445,6 +445,31 @@ func Test_set_errors() call assert_fails('set t_#-&', 'E522:') endfunc +func Test_set_encoding() + let save_encoding = &encoding + + set enc=iso8859-1 + call assert_equal('latin1', &enc) + set enc=iso8859_1 + call assert_equal('latin1', &enc) + set enc=iso-8859-1 + call assert_equal('latin1', &enc) + set enc=iso_8859_1 + call assert_equal('latin1', &enc) + set enc=iso88591 + call assert_equal('latin1', &enc) + set enc=iso8859 + call assert_equal('latin1', &enc) + set enc=iso-8859 + call assert_equal('latin1', &enc) + set enc=iso_8859 + call assert_equal('latin1', &enc) + call assert_fails('set enc=iso8858', 'E474:') + call assert_equal('latin1', &enc) + + let &encoding = save_encoding +endfunc + func CheckWasSet(name) let verb_cm = execute('verbose set ' .. a:name .. '?') call assert_match('Last set from.*test_options.vim', verb_cm) diff --git a/src/version.c b/src/version.c index 399aef93c2..23f45b5c17 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4439, +/**/ 4438, /**/ 4437, |