Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.development.apps > #219

Checking if the terminal supports Unicode programmatically

From Mark Hobley <markhobley@yahoo.donottypethisbit.co>
Newsgroups comp.os.linux.development.apps
Subject Checking if the terminal supports Unicode programmatically
Date 2011-07-24 21:48 +0000
Organization A noiseless patient Spider
Message-ID <j0i3um$nea$1@dont-email.me> (permalink)

Show all headers | View raw


What is the best way to check if the terminal supports Unicode or not?
Is there a capability in terminfo that can be queried? or is there a
specific environment variable that indicates Unicode support. For example
must TERM=unicode for a Unicode terminal? Or what is the test for this?
A configuration check, rather than a physical enquiry to the terminal would
be fine. However, the terminal may be a /dev/pts from a telnet session and
it would be useful to know if the terminal supports Unicode or not?

I want to achieve something like this pseudocode:

IF terminalsupportsunicode == true THEN
  useunicode = true
  echo "\u0394"    # Unicode delta
ELSE
  useunicode = false
  echo "This terminal does not support Unicode. Reverting to ASCII."
ENDIF

-- 
Mark Hobley
Linux User: #370818  http://markhobley.yi.org/

Back to comp.os.linux.development.apps | Previous | NextNext in thread | Find similar


Thread

Checking if the terminal supports Unicode programmatically Mark Hobley <markhobley@yahoo.donottypethisbit.co> - 2011-07-24 21:48 +0000
  Re: Checking if the terminal supports Unicode programmatically Måns Rullgård <mans@mansr.com> - 2011-07-24 23:28 +0100
    Re: Checking if the terminal supports Unicode programmatically Richard Kettlewell <rjk@greenend.org.uk> - 2011-07-25 09:05 +0100

csiph-web