I'd like to add the Unicode skull and crossbones to my shell prompt (specifically the 'SKULL AND CROSSBONES' (U+2620)), but I can't figure out the magic incantation to make echo spit it, or any other, 4-digit Unicode character. Two-digit one's are easy. For example, echo -e "\x55"
, .
In addition to the answers below it should be noted that, obviously, your terminal needs to support Unicode for the output to be what you expect. gnome-terminal does a good job of this, but it isn't necessarily turned on by default.
On macOS's Terminal app Go to Preferences-> Encodings and choose Unicode (UTF-8).
"\x7F"
in a UTF-8 locale (which thebash
tag suggests yours is)... patterns represented by a single byte are never in the range\x80-\xFF
. This range is illegal in singl-byte UTF-8 chars. eg a Unicode Codepoint value ofU+0080
(ie.\x80
) is actually 2 bytes in UTF-8..\xC2\x80
.. – Peter.Oprintf "\\u007C\\u001C"
. – kenorbgnome-terminal
,echo -e '\ufc'
does not produce a ü, even with character encoding set to UTF-8. However, egurxvt
does print egprintf "\\ub07C\\ub01C"
as expected (not with a � or box). – isomorphismesbash
tag such a useful hint? Are different terminals common in CJK or … ? – isomorphismes