You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider extending \x to support non-ASCII characters #1352
Currently \x escapes an ASCII value, and \X escapes a byte value. \x is "safe", because it cannot be used to generate invalid sequences: echo \xE4 is a syntax error. \X is "dangerous" because it can, e.g. echo \XE4 is accepted and results in an invalid UTF-8 sequence.
This bug tracks whether we should extend \x to allow escaping non-ASCII characters. An open question is whether it should escape byte values or characters. That is, does \xE4 generate the literal byte 0xE4, or the unichar U+00E4.
Spun off from #1225 . See that bug for more discussion.
I just ran into this issue, and came here to report a bug. Expressing support for proper \x support, as defined in POSIX. That is, echo -ne "\xFF" should output a literal 0xFF to stdout.
Yeah, I don't see a use for a "checking-hex" escape - you already decided to use hex values, so you probably know what you are doing or want the actual bytes!
I would just make \x and \X the same. Unless anyone disagrees, I'm going to implement that.
Activity
ddevault commentedon Mar 27, 2014
I just ran into this issue, and came here to report a bug. Expressing support for proper \x support, as defined in POSIX. That is,
echo -ne "\xFF"should output a literal 0xFF to stdout.faho commentedon Sep 26, 2022
Yeah, I don't see a use for a "checking-hex" escape - you already decided to use hex values, so you probably know what you are doing or want the actual bytes!
I would just make \x and \X the same. Unless anyone disagrees, I'm going to implement that.
krobelus commentedon Sep 29, 2022
sounds good, thanks. Both
\xe4and\Xe4should produce that byte. For Unicode characters we already have\u00e4Make \x the same as \X
Make \x the same as \X
Make \x the same as \X
Make \x the same as \X