vim-patch:9.2.0769 conversion to utf-16be using iconv is inconsistent #40567

fix(iconv): conversion to utf-16be using iconv is inconsistent

vim-patch:9.2.0769

Problem:  enc_canonize function changes utf-16be to utf-16 but in linux
          type utf-16 defaults to utf-16le.

Solution: Creating a separate entry for utf-16be in enc_canon_table.
          Note: the effect is only visible on iconv implementations that
          treat "utf-16" and "utf-16be" differently, so the test does
          not necessarily fail on an unpatched Vim. But the bug is
          visible in vim.iconv. (Manoj Panda)

from: vim/vim@2a63f74
closes: neovim#40262

Signed-off-by: Manoj Panda <manojpandawork@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Manoj Panda
2026-07-04 17:20:38 +05:30
committed by GitHub
parent abedbfc175
commit 9456cec7f9
3 changed files with 82 additions and 42 deletions

View File

@@ -11,6 +11,7 @@ local dedent = t.dedent
local insert = n.insert
local clear = n.clear
local eq = t.eq
local neq = t.neq
local ok = t.ok
local pesc = vim.pesc
local eval = n.eval
@@ -2672,6 +2673,17 @@ describe('lua stdlib', function()
]]
)
end)
it('utf-16le should not be equal to utf-16be', function()
neq(
exec_lua [[
return vim.iconv('hello', 'utf-8', 'utf-16le')
]],
exec_lua [[
return vim.iconv('hello', 'utf-8', 'utf-16be')
]]
)
end)
end)
describe('vim.defaulttable', function()