From 1d3e9a664c9a902354ae9b3218035da818233841 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Thu, 23 Oct 2003 16:08:42 +0000 Subject: [PATCH] isttyutf8: New script to guess whether a terminal speaks UTF-8. Still eats pending input when invoked, which is a bug. --- isttyutf8 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 isttyutf8 diff --git a/isttyutf8 b/isttyutf8 new file mode 100755 index 0000000..2b3d9b9 --- /dev/null +++ b/isttyutf8 @@ -0,0 +1,12 @@ +#! /bin/sh +set -e + +[ -t 0 ] || exit 1 + +# TODO: eats pending keystrokes somehow. +result="$(ctlseq -r -R CR "$(printf '\xc3\xb6')" CSI 6 n CR SP SP CR)" +if expr "$result" : '.\+;2R' >/dev/null; then + exit 0 +else + exit 1 +fi -- 2.30.2