Am 30.09.2025 um 00:52 schrieb Mark Geisert via Cygwin:
Hello Thomas,
Apologies for the late response to your report.
Thanks, I actually had feedback on the issue. From Corinna in another thread I guess.

On 7/21/2025 8:25 PM, Thomas Wolff via Cygwin wrote:
mbrtowc is broken in 3.6.4 which breaks non-BMP display in mintty.
Test case below.
Thomas

#include <locale.h>
#include <wchar.h>
#include <stdio.h>

void mb(unsigned char c)
{
   wchar_t wc;
   int ret = mbrtowc(&wc, &c, 1, 0);
   printf("%02X -> %04X : %d\n", c, wc, ret);
}

void main ()
{
   setlocale (LC_CTYPE, "");

   mb(0xF0);
   mb(0x9F);
   mb(0x98);
   mb(0x8E);
}

Running your testcase gives different output between 3.6.4 and 3.7.0-dev-139 but I'm unsure the latter is correct.  Can you comment please?
The issue was fixed soon already and it works in 3.7.0 test releases.
Furthermore, mintty 3.8.1 has a workaround for it so it works also in 3.6.4, but only for UTF-8 encoding, not for CJK multibyte encodings where the issue also hits.


On 3.6.4:
~ ./a
F0 -> 0000 : -2
9F -> 0000 : -2
98 -> 0000 : -2
8E -> D83D : 3

On 3.7.0-dev-139:
~ ./a
F0 -> 0000 : -2
9F -> 0000 : -2
98 -> D83D : 1
8E -> DE0E : 1

Thanks much,

..mark



--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

Reply via email to