coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fold: add the --characters option


From: Bruno Haible
Subject: Re: fold: add the --characters option
Date: Sun, 24 Aug 2025 02:24:53 +0200

Collin Funk wrote:
> >>      if (STREQ_OPT (locale_charset (), "ASCII",
> >>                     'A', 'S', 'C', 'I', 'I', 0, 0, 0, 0))
> >>        fold_file (...)
> >>      else
> >>        fold_file_multibyte (...)

I would rename the first function to 'fold_file_ascii' or 'fold_file_unibyte'.

> My understanding is that hard_locale checks whether the locale is "C" or
> "POSIX" not the character set in use.

Correct. If you want to test the encoding (with is, admittedly, the most
important characteristic of the LC_CTYPE category of the current locale),
you can
  - test for specific encodings by using the value of locale_charset (),
  - distinguish unibyte vs. multibyte locales by testing (MB_CUR_MAX > 1).

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]