From: Bruno Haible <bruno@clisp.org>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] swprintf %lc directive does not work for some wide characters
Date: Mon, 12 Jun 2023 22:53:24 +0200 [thread overview]
Message-ID: <4793858.F8r316W7xa@nimes> (raw)
In-Reply-To: <20230612202728.GB4163@brightrain.aerifal.cx>
Rich Felker wrote:
> Per my reading of the specification, this is not a bug but is the
> expected behavior.
>
> In addition, all forms of fwprintf() shall fail if:
>
> [EILSEQ]
> A wide-character code that does not correspond to a valid
> character has been detected.
From my reading of ISO C, it's a bug. Namely, in ISO C 23 § 7.31.2.3
the error conditions are specified as
"The swprintf function returns the number of wide characters written
in the array, not counting the terminating null wide character,
or a negative value if
an encoding error occurred
or if n or more wide characters were requested to be written."
In swprintf, where "the wint_t argument converted to wchar_t" is written
and the output is to a wchar_t[], no "encoding error" should be possible.
That's obvious. The "encoding errors" occur in %c and %s directives,
AFAIU, not in %lc and %ls directives.
Bruno
next prev parent reply other threads:[~2023-06-12 20:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 14:44 Bruno Haible
2023-06-12 20:27 ` Rich Felker
2023-06-12 20:53 ` Bruno Haible [this message]
2023-06-12 21:28 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4793858.F8r316W7xa@nimes \
--to=bruno@clisp.org \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).