We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d3716a5 commit 78ff007Copy full SHA for 78ff007
std/src/sys/pal/windows/api.rs
@@ -68,6 +68,8 @@ pub const fn utf16_len(s: &str) -> usize {
68
n => n as usize,
69
};
70
i += utf8_len;
71
+ // Note that UTF-16 surrogates (U+D800 to U+DFFF) are not encodable as UTF-8,
72
+ // so (unlike with WTF-8) we don't have to worry about how they'll get re-encoded.
73
len += if utf8_len < 4 { 1 } else { 2 };
74
}
75
len
0 commit comments