mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-11 22:21:14 -03:00
Show un-decodable inputs as bytes instead of the internal encoding
When the input is invalid UTF8, we re-encode the raw bytes using the private use area. Let's make sure we convert back before printing.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
common::{escape_string, EscapeFlags, EscapeStringStyle},
|
||||
fallback::fish_wcwidth,
|
||||
reader::TERMINAL_MODE_ON_STARTUP,
|
||||
wchar::prelude::*,
|
||||
wchar::{decode_byte_from_char, prelude::*},
|
||||
wutil::{fish_is_pua, fish_wcstoi},
|
||||
};
|
||||
|
||||
@@ -453,6 +453,8 @@ pub fn char_to_symbol(c: char) -> WString {
|
||||
} else if c < '\u{80}' {
|
||||
// ASCII characters that are not control characters
|
||||
ascii_printable_to_symbol(buf, c);
|
||||
} else if let Some(byte) = decode_byte_from_char(c) {
|
||||
sprintf!(=> buf, "\\x%02x", byte);
|
||||
} else if ('\u{e000}'..='\u{f8ff}').contains(&c) {
|
||||
// Unmapped key from https://sw.kovidgoyal.net/kitty/keyboard-protocol/#functional-key-definitions
|
||||
sprintf!(=> buf, "\\u%04X", u32::from(c));
|
||||
|
||||
Reference in New Issue
Block a user