bug-gnulib
[Top][All Lists]
Advanced

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

Re: From wchar_t to char32_t


From: Paul Eggert
Subject: Re: From wchar_t to char32_t
Date: Tue, 4 Jul 2023 16:07:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

On 2023-07-04 12:31, Bruno Haible wrote:
Yes.

As far as I can see, this proposed patch should cope with (size_t) -3
returns correctly.

I still see a couple of problems with it. First, it mishandles the case where mbrtoc32 returns 0, which ISO C allows.

Second and more interestingly, its "fwrite (tp0, 1, bytes, out);" could output a byte string that represents multiple characters where the first character fits in the output column width but the remaining characters do not, and this would exceed the output column width.

I suppose one could fix the second problem by not outputting such a byte string, just as the code already suppresses the output of a byte string representing a single character that occupies multiple columns straddling the column border. That is, count all the columns of all the characters that the byte string represents, before deciding whether to output the byte string.




reply via email to

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