Skip to content

Commit

Permalink
Handle 8-bit characters under LOCALE=C
Browse files Browse the repository at this point in the history
Even when the character set is specified as ASCII, we should handle data
outside the 7-bit range gracefully by simply copying it, even if it is
technically no longer ASCII.

This fixes several of Git for Windows' tests, e.g. t7400.

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Jan 28, 2025
1 parent 3f0076c commit a981980
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions winsup/cygwin/strfuncs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,11 @@ _sys_mbstowcs (mbtowc_p f_mbtowc, wchar_t *dst, size_t dlen, const char *src,
to store them in a symmetric way. */
bytes = 1;
if (dst)
#ifdef STRICTLY_7BIT_ASCII
*ptr = L'\xf000' | *pmbs;
#else
*ptr = *pmbs;
#endif
memset (&ps, 0, sizeof ps);
}

Expand Down

0 comments on commit a981980

Please sign in to comment.