Based on this answer, I hoped that the following would work:
# Is emoji supported by the terminal?
function is_emoji_supported {
[ "$(echo -ne '\xE0\xA5\xA5' | wc -m)" -eq 1 ]
}
I'm guessing that this doesn't work because wc
never looks at the terminal's view of characters, but rather LC_
*.
Is there a (ideally POSIX) way of determining whether the terminal purports to support emoji?
*
and#
are emojis as per unicode. – Stéphane Chazelas Aug 16 '19 at 12:040xE0 0xA5 0xA5
is the UTF-8 encoding of U+0965, a character in the Devanagari script, not an emoji in any definition of emoji I can think of. Do you mean non-ASCII character? – Stéphane Chazelas Aug 17 '19 at 07:26