We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3bcd03a commit ae03f89Copy full SHA for ae03f89
library/std/src/sys/pal/windows/api.rs
@@ -73,6 +73,8 @@ pub const fn utf16_len(s: &str) -> usize {
73
n => n as usize,
74
};
75
i += utf8_len;
76
+ // Note that UTF-16 surrogates (U+D800 to U+DFFF) are not encodable as UTF-8,
77
+ // so (unlike with WTF-8) we don't have to worry about how they'll get re-encoded.
78
len += if utf8_len < 4 { 1 } else { 2 };
79
}
80
len
0 commit comments