I'm running Arch Linux with simple terminal using the Adobe Source Code Pro font. My locale is correctly set to LANG=en_US.UTF-8
.
I want to print Unicode characters representing playing cards to my terminal. I'm using Wikipedia for reference.
The Unicode characters for card suits work fine. For example, issuing
$ printf "\u2660"
prints a black heart to the screen.
However, I'm having trouble with specific playing cards. Issuing
$ printf "\u1F0A1"
prints the symbol Ἂ1
instead of the ace of spades ?. What's going wrong?
This problem persists across several terminals (urxvt, xterm, termite) and every font I've tried (DejaVu, Inconsolata).
Best Answer
help printf
defers toprintf(1)
for the escape sequences interpreted, and the docs for GNU printf says:Something similar is specified in the Bash manual for ANSI C Quoting and
echo
:In short:
\u
is not for 5 hex digits. It's\U
: