1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Patch from Yoshida Masato to fill in the missing pieces of Windows

UTF-16 support. High Unicode characters in the terminal are now
converted back into surrogates during copy and draw operations, and
the Windows drawing code takes account of that when splitting up the
UTF-16 string for display. Meanwhile, accidental uses of wchar_t have
been replaced with 32-bit integers in parts of the cross-platform code
which were expecting not to have to deal with UTF-16.

[originally from svn r9409]
This commit is contained in:
Simon Tatham
2012-02-17 19:28:55 +00:00
parent e350ca2b4e
commit 053d2ba6d1
6 changed files with 155 additions and 27 deletions

View File

@ -51,13 +51,12 @@ void luni_send(void *handle, wchar_t * widebuf, int len, int interactive)
for (p = linebuffer, i = 0; i < len; i++) {
unsigned long ch = widebuf[i];
if ((ch & 0xF800) == 0xD800) {
if (IS_SURROGATE(ch)) {
#ifdef PLATFORM_IS_UTF16
if (i+1 < len) {
unsigned long ch2 = widebuf[i+1];
if ((ch & 0xFC00) == 0xD800 &&
(ch2 & 0xFC00) == 0xDC00) {
ch = 0x10000 + ((ch & 0x3FF) << 10) + (ch2 & 0x3FF);
if (IS_SURROGATE_PAIR(ch, ch2)) {
ch = FROM_SURROGATES(ch, ch2);
i++;
}
} else