Hi, At Fri, 9 Nov 2001 18:28:27 +0000 (GMT), Markus Kuhn wrote:
> On Thu, 8 Nov 2001, Daniel Yacob wrote: > > Is there a way to detect if the terminal that a script is running in > > can display UTF-8 text? > > No, not by communicating with the terminal directly. There is > neither a practical method that doesn't involve asking the user > for what she can see, nor is there a recommendable formal > standard solution. I think it would be helpful if terminal itself sets some environmental variable for this purpose. Here is an example of such variables. TERMENCODING This would be set by the terminal and will be one of followings: ASCII, ISO-8859-*, KOI8-*, EUC-*, ISO-2022-*, UTF-*, TIS-620, VISCII, and so on. TERMENCODINGINFO This would be set by the terminal and give additional information about implement level of encodings. This would be a list of features separated by comma. This information does not imply that the used fonts actually includes needed glyphs. When TERMENCODING=UTF-* C1 : combining characters level 1 C2 : combining characters level 2 DB : doublewidth characters D2 : doublewidth characters (EastAsianAmbiguous = 2 columns) BD : bidi Pn : page n support. (n = 0 (=BMP), 1 (=SMP), 2 (=SIP), ...) and so on. When TERMENCODING=EUC-JP 12 : JIS X 0212 support KA : JIS X 0201 Kana support TERMENCODING2022 This would be set by the terminal and give information on ISO-2022 charset selection support. This ould be a list of features separated by comma. names of charsets: supported charsets Gn : usage of Gn (n = 0, 1, 2, or 3) Gx : usage of Gx (x = R or L) These information can be used to set LANG variable in .bashrc and so on. For example, we want to set LANG=C when the terminal cannot display our favorite languages. Are there any better way than environmental variables? A problem of environmental variables is that it is inherited into terminals which doesn't set the above variables. --- Tomohiro KUBOTA <[EMAIL PROTECTED]> http://www.debian.or.jp/~kubota/ "Introduction to I18N" http://www.debian.org/doc/manuals/intro-i18n/