1
0
mirror of https://github.com/junegunn/fzf.git synced 2025-07-28 02:31:59 -07:00

Ignore invalid byte sequence in UTF-8

This commit is contained in:
Junegunn Choi
2024-07-22 13:12:54 +09:00
parent c790ab2024
commit e8a39eeb0f

@@ -71,7 +71,7 @@ if command -v ruby > /dev/null; then
h = {} h = {}
i = 0 i = 0
File.read("/tmp/fzf-bash-history").scan(/^#([0-9]+)$\n(.*?)\n(?=^#[0-9]+$|\z)/m) do |t, c| File.read("/tmp/fzf-bash-history").encode!("UTF-8", "UTF-8", :invalid => :replace).scan(/^#([0-9]+)$\n(.*?)\n(?=^#[0-9]+$|\z)/m) do |t, c|
next if c.empty? next if c.empty?
h.delete(c) h.delete(c)
h[c] = [i += 1, t] h[c] = [i += 1, t]