mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-22 18:21:13 -03:00
Two issues: 1. typing the codepoint 0x123456 into fish_key_reader: $ fish_key_reader -cV # decoded from: \xf4\xa3\x91 bind \xf4 'do something' # decoded from: bind \xa3 'do something' # decoded from: bind \x91 'do something' The invalid codepoint is represented in its original encoding, which leaks to the UI. This was more or less intentionally added byb77d1d0e2b(Stop crashing on invalid Unicode input, 2024-02-27). That commit rendered it as replacement byte, but that was removed for other reasons ine25a1358e6(Work around broken rendering of pasted multibyte chars in non-UTF-8-ish locale, 2024-08-03). We no longer insert such (PUA) codepoints into the commandline. The "bind" comes above would work however. I don't think this is something we want to support. Discard invalid codepoints in the reader, so they can't be bound and fish_key_reader shows nothing. 2. builtin read silently drops invalid encodings This builtin is not really suited to read binary data (#11383 is an error scenario), but I guess it can be bent to do that. Some of its code paths use str2wcstring which passes through e.g. invalid UTF-8. The read-one-char-at-a-time code path doesn't. Fix this.