Revision: 8335 https://osdn.net/projects/ttssh2/scm/svn/commits/8335 Author: zmatsuo Date: 2019-10-28 22:07:28 +0900 (Mon, 28 Oct 2019) Log Message: ----------- UTF8ToWideChar() 文字列長の算出の誤りを修正 - サロゲートペア時(U+10000-U+10FFFF)の時 Modified Paths: -------------- trunk/teraterm/common/codeconv.cpp -------------- next part -------------- Modified: trunk/teraterm/common/codeconv.cpp =================================================================== --- trunk/teraterm/common/codeconv.cpp 2019-10-27 03:39:26 UTC (rev 8334) +++ trunk/teraterm/common/codeconv.cpp 2019-10-28 13:07:28 UTC (rev 8335) @@ -747,7 +747,7 @@ u8_len = u8_len_; } if (wstr_ptr == NULL) { - wstr_len = 1; + wstr_len = 2; } while(wstr_len > 0 && u8_len > 0) { @@ -773,7 +773,7 @@ } u16_out = 1; } else if (u32 <= 0x10ffff) { - if (wstr_len > 2) { + if (wstr_len >= 2) { if (wstr_ptr != NULL) { // \x83T\x83\x8D\x83Q\x81[\x83g \x83G\x83\x93\x83R\x81[\x83h *wstr_ptr++ = uint16_t((u32 - 0x10000) / 0x400) + 0xd800;