Skip to content

Commit

Permalink
Use MB_CUR_MAX == 6 by default
Browse files Browse the repository at this point in the history
Internally, Cygwin already uses __utf8_mbtowc(), even if it still claims
to use the "ASCII" charset.

But the `MB_CUR_MAX` value (which is not actually a constant, but
dependent on the current locale) was still 1, which broke the initial
`globify()` call while parsing the the command-line in `build_argv()`
for non-ASCII arguments.

This fixes git-for-windows/git#2189 and is
needed to let Git's t7400.108(submodule with UTF-8 name) pass, which
otherwise fails with:

  ++ git submodule add './å äö'
  fatal: repo URL: '"./å äö"' must be absolute or begin with ./|../

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Dec 18, 2023
1 parent 0338b1a commit 1b0ab77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions newlib/libc/locale/lctype.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@

#define LCCTYPE_SIZE (sizeof(struct lc_ctype_T) / sizeof(char *))

#ifdef __CYGWIN__
/* Cygwin uses __utf8_mbtowc() by default, therefore mb_cur_max := 6 */
static char numone[] = { '\x06', '\0'};
#else
static char numone[] = { '\1', '\0'};
#endif

const struct lc_ctype_T _C_ctype_locale = {
"ASCII", /* codeset */
Expand Down

0 comments on commit 1b0ab77

Please sign in to comment.