diff --git a/lua/telescope/builtin/__files.lua b/lua/telescope/builtin/__files.lua index 1a1757d..339ede6 100644 --- a/lua/telescope/builtin/__files.lua +++ b/lua/telescope/builtin/__files.lua @@ -126,6 +126,10 @@ files.live_grep = function(opts) end end + if opts.file_encoding then + additional_args[#additional_args + 1] = "--encoding=" .. opts.file_encoding + end + local args = flatten { vimgrep_arguments, additional_args } opts.__inverted, opts.__matches = opts_contain_invert(args) @@ -187,6 +191,10 @@ files.grep_string = function(opts) end end + if opts.file_encoding then + additional_args[#additional_args + 1] = "--encoding=" .. opts.file_encoding + end + if search == "" then search = { "-v", "--", "^[[:space:]]*$" } else diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua index 690db65..68af228 100644 --- a/lua/telescope/make_entry.lua +++ b/lua/telescope/make_entry.lua @@ -326,10 +326,9 @@ do end end - local text = opts.file_encoding and vim.iconv(entry.text, opts.file_encoding, "utf8") or entry.text local display, hl_group, icon = utils.transform_devicons( entry.filename, - string.format(display_string, display_filename, coordinates, text), + string.format(display_string, display_filename, coordinates, entry.text), disable_devicons )