mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 19:41:14 -03:00
str2wcs: encode invalid Unicode characters in the private use area
Rust does not like invalid code points, so let's ease the transition by treating them like byte sequences that do not map to any code point. See https://github.com/fish-shell/fish-shell/pull/9688#discussion_r1155089596
This commit is contained in:
@@ -338,6 +338,8 @@ static wcstring str2wcs_internal(const char *in, const size_t in_len) {
|
||||
// Determine whether to encode this character with our crazy scheme.
|
||||
if (wc >= ENCODE_DIRECT_BASE && wc < ENCODE_DIRECT_BASE + 256) {
|
||||
use_encode_direct = true;
|
||||
} else if ((wc >= 0xD800 && wc <= 0xDFFF) || static_cast<uint32_t>(wc) >= 0x110000) {
|
||||
use_encode_direct = true;
|
||||
} else if (wc == INTERNAL_SEPARATOR) {
|
||||
use_encode_direct = true;
|
||||
} else if (ret == static_cast<size_t>(-2)) {
|
||||
|
||||
Reference in New Issue
Block a user