diff --git a/src/common.cpp b/src/common.cpp index 854fbd3a8..c7ced748c 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -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(wc) >= 0x110000) { + use_encode_direct = true; } else if (wc == INTERNAL_SEPARATOR) { use_encode_direct = true; } else if (ret == static_cast(-2)) {