Skip to content

Instantly share code, notes, and snippets.

@mgor

mgor/test_unicode.sh

Last active Dec 2, 2016
Embed
What would you like to do?
test if terminal supports unicode
test_unicode() {
echo -ne "\xe2\x88\xb4\033[6n\033[1K\r"
# shellcheck disable=SC2034
read -d R foo
echo -ne "\033[1K\r"
echo -e "${foo}" | cut -d \[ -f 2 | cut -d";" -f 2 | (
read UNICODE
[[ $UNICODE -eq 2 ]]
) 2>/dev/null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.