On 3/8/24 10:56 AM, Emanuele Torre wrote:
Hello.I have noticed that, in C locale, %lc prints nothing if the first byte of the argument is non-ASCII (0x80-0xff).
Only on Linux, and maybe other systems that prefer precomposed unicode characters. (NFC/NFD is kind of a mess, and has been discussed here previously.) The issue is that glibc wc[r]tomb/wcs[r]tombs return -1/EILSEQ when supplied a wide character in a locale where MB_CUR_MAX == 1. Other systems (macOS) store a single byte in the returned string. printf converts the supplied multibyte character string to a wide character string to get the precision right, then converts it back, which is how these functions are involved. Maybe printf should just ignore the `l' modifier and treat %C/%S like %c/%s if MB_CUR_MAX == 1. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature