From e8a39eeb0fce97a35cf4e751c8b7a25552066b83 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 22 Jul 2024 13:12:54 +0900 Subject: [PATCH] Ignore invalid byte sequence in UTF-8 --- shell/key-bindings.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index 6035a978112..174cd647eb8 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -71,7 +71,7 @@ if command -v ruby > /dev/null; then h = {} 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? h.delete(c) h[c] = [i += 1, t]