Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Feb 1998 08:55:15 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        j_mini@efn.org
Cc:        tlambert@primenet.com, hackers@FreeBSD.ORG, questions@FreeBSD.ORG
Subject:   Re: character-set information for terminals.
Message-ID:  <199802050855.BAA13565@usr08.primenet.com>
In-Reply-To: <19980204234005.30868@micron.mini.net> from "Jonathan Mini" at Feb 4, 98 11:40:05 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > What exactly do you need?
> 
>   I needed to know the font (i.e. iso 8859-l1, cp 437, etc, etc) that the
> user's terminal was running. Looks like the _CLOSEST_ I can get without
> asking the user is to grab the line drawing and a few other symbols from
> the termcap. *sigh* This leaves much to be desired, since a lot isn't in
> the termcap, such as character accents and other similar things. 
> 
>   The locale does not give me that information. All it tells me is the
> formatting of various standardized things such as tiem time, date, and
> currency. 
> 
>   I guess you misunderstood my original question : I need to know how to
> find out what font (or "character set") the user has on their terminal.
> Looks like there isn't really any way of auto-detecting that.

1)	Set the locale environment, per my other message.

2)	Use an existing locale that matches the device capabilities

3)	If there is no existing locale that mataches the capabilities,
	then you must create one.  For example "DEC_VT200_NRCS_SPAIN"
	for a 7 bit DEC vt220 using NRCS (National Replacement Character
	Set), Spanish language version.

4)	Set the invented local, per #1, in the environment of the device
	pgysically attached to the line in /etc/ttys that matches the
	gettytab entry you created to set the locale.

5)	man isprint

The isprint function is guaranteed to tell you whether or not a given
character is printable on the current device, which is in the specified
locale.

If you need ISO locales, use ISO locale names matching the devices
capabilities.

If you need cp437, use the cp437-to-Unicode and Unicode-to-WHATEVER
tables at www.unicode.org to convert the charactersets.  If "isprint"
on all (howevermany) characters in the code page abomination you are
using return "true", then the deive is capable of displaying in that
"code page".

This test and the associated overhead is the "sweat equity" you pay
for using oddball "standards".

The problem with defining things in Microsoft/IBM code pages instead
of ISO standards is that you are unlikely to ever be able to find a
serial terminal from a manufacturer other than Wyse and a few others
(and even then, not all models, only a few) that support the abstraction.
Whereas every terminal in Western Europe, unless it's a Wyse-60 or other
oddball device, will conform to some ISO standard or another.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802050855.BAA13565>