diff mbox series

[2/2] man: printf: in 'X, X is a byte under dash

Message ID d4a95c9b5772db68b6ae7a00f2f2c3d0535ca1ca.1660436383.git.nabijaczleweli@nabijaczleweli.xyz (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series [1/2] man: printf: all Ar arguments are processed identically | expand

Commit Message

Ahelenia Ziemiańska Aug. 14, 2022, 12:20 a.m. UTC
Multiple issues:
  * the encoding is not always ASCII
  * what ASCII code is assigned to я
  * dash isn't internationalised
    (this is nonconformant but out of scope),
    and uses the next /byte/; in a UTF-8 locale:
      $ printf %d\\n \'ą
      196
      $ printf %d\\n \'я
      196
    this is in contrast to POSIX (and bash), which says:
      > If the leading character is a single-quote or double-quote,
      > the value shall be the numeric value in the underlying codeset
      > of the character following the single-quote or double-quote.
    (i.e. mbrtowc(&val, argv[n], ...))

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 src/dash.1 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/dash.1 b/src/dash.1
index bd5c311..19d4d3b 100644
--- a/src/dash.1
+++ b/src/dash.1
@@ -1556,9 +1556,7 @@  otherwise it is evaluated as a C constant, with the following extensions:
 .It
 A leading plus or minus sign is allowed.
 .It
-If the leading character is a single or double quote, the value is the
-.Tn ASCII
-code of the next character.
+If the leading character is a single or double quote, the value of the next byte.
 .El
 .Pp
 The format string is reused as often as necessary to satisfy the