Re: \c escape within $'...' can produce mangled UTF-8
From:
Greg Wooledge
Subject:
Re: \c escape within $'...' can produce mangled UTF-8
Date:
Mon, 16 Aug 2010 08:28:24 -0400
User-agent:
Mutt/1.4.2.3i
On Sun, Aug 15, 2010 at 02:02:05PM +0400, Dmitry Groshev wrote:
> You are wrong. Try "echo $'\x{123456}AB'" and look at the result.
> Or read the source code: lib/sh/strtans.c
The manual (bash 4.1) says:
\xHH the eight-bit character whose value is the hexadecimal value
HH (one or two hex digits)
My bash (also 4.1) says:
imadev:~$ echo $'\x{123456}AB'
VAB
So, it looks like the undocumented feature that you asked us to test
for you is only respecting the last two hex digits inside the curly
braces. Since none of this behavior is documented, I wouldn't count
on bash retaining that behavior in the future.