]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: printf: make "java" encoding example more standard
authorPádraig Brady <P@draigBrady.com>
Fri, 28 Oct 2022 13:40:28 +0000 (14:40 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 28 Oct 2022 13:51:56 +0000 (14:51 +0100)
Note using iconv(1) rather than recode(1) is not appropriate
for this example, as the required functionality is only
available on libiconv's iconv implementation, which is
not installed on most systems.

* doc/coreutils.texi (printf invocation): Use env rather than
/usr/local/bin for the printf command.  Escape '%' so more robust.
Also use a locale that exists on modern systems.

doc/coreutils.texi

index 0662e4e33f9f330ef8ac29ee122d6870ce9e6c3d..d82c86709a30e07d18f0fcd626aa294e03582a92 100644 (file)
@@ -13255,10 +13255,10 @@ is how to convert a piece of text into a shell script which will output
 this text in a locale-independent way:
 
 @example
-$ LC_CTYPE=zh_CN.big5 /usr/local/bin/printf \
+$ LC_CTYPE=zh_TW.big5 env printf \
     '\u4e2d\u6587\n' > sample.txt
 $ recode BIG5..JAVA < sample.txt \
-    | sed -e "s|^|/usr/local/bin/printf '|" -e "s|$|\\\\n'|" \
+    | sed -e "s|^|env printf '|" -e "s|%|%%|g" -e "s|$|\\\\n'|" \
     > sample.sh
 @end example