df no longer corrupts displayed multibyte characters on macOS.
+ [bug introduced with coreutils-8.18]
+
+** Changes in behavior
+
+ echo now always processes backslash escapes when the POSIXLY_CORRECT
+ environment variable is set.
Having re-read the POSIX wording, I'm not quite sure we are still accurate.
A string to be written to standard output. If the first operand is -n,
or if any of the operands contain a <backslash> character, the results
are implementation-defined.
and then with XSI shading states:
On XSI-conformant systems, if the first operand is -n, it shall be
treated as a string, not an option.
So my initial patch (which you took and improved) still isn't quite right.
+
+# With POSIXLY_CORRECT:
+# only -n as the first (separate) option enables option processing
Rather, not even -n should get special treatment as an option.
+# -E is ignored
+# escapes are processed by default
+POSIXLY_CORRECT=1 $prog -n -E 'foo\n' > out || fail=1
So I would argue that this should output $'-n -E foo\n'.