Skip to content

Commit

Permalink
feat: use vim.iconv
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis6991 committed Dec 16, 2022
1 parent 947811c commit 79bb564
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 9 additions & 3 deletions lua/gitsigns/git.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions teal/gitsigns/git.tl
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,16 @@ function Repo:get_show_text(object: string, encoding: string): {string}, string

if encoding ~= 'utf-8' then
scheduler()
for i, l in ipairs(stdout) do
-- TODO(lewis6991): How should we handle blob types?
if vim.fn.type(l) == vim.v.t_string then
stdout[i] = vim.fn.iconv(l, encoding, 'utf-8')
if vim.iconv then
for i, l in ipairs(stdout) do
stdout[i] = vim.iconv(l, encoding, 'utf-8')
end
else
for i, l in ipairs(stdout) do
-- vimscript will interpret strings containing NUL as blob type
if vim.fn.type(l) == vim.v.t_string then
stdout[i] = vim.fn.iconv(l, encoding, 'utf-8')
end
end
end
end
Expand Down

0 comments on commit 79bb564

Please sign in to comment.