Unicode escapes in Bash 4.3+

I suspect you're having locale issues, even if you don't have Bash versionitis problems on your system. Here I'll assume your Bash is version 4.something-- mine, on Ubuntu 14.04, is version 4.3.11. You can always check this as indicated in the other comments.

The problem is that $'\u2603', or echo -e '\u2603', or printf '\u2603\n' only work as you expect in a unicode locale, typically 'en_US.utf8'. Sometimes Bash shells start up in the 'posix' locale or the 'C' locale instead. (This depends on what is set in .bashrc). Check the current locale with the locale command. The posix locale would show LC_ALL= and the C locale would show LC_ALL=C. (Strictly speaking, only the LC_CTYPE variable matters in this context. In the posix locale, this will read LC_CTYPE=posix.)

You can change the locale to utf8 with export LC_ALL=en_US.utf. If LC_ALL=en_US.utf8, and you execute printf, you get the skull-and-crossbones: $ printf '\u2603\n' ☃

But if LC_ALL=C or LC_ALL=, you get: $ printf '\u2603\n' \u2603

Same code, different results!

You can change the locale on the fly, for one command only, with the env command. For example: $ env LC_ALL=en_US.utf8 printf '\u2603\n' ☃

This would work regardless of the current locale when the command is executed.

/r/bash Thread