From owner-freebsd-hackers Thu Feb 5 00:55:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id AAA14874 for hackers-outgoing; Thu, 5 Feb 1998 00:55:38 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from smtp03.primenet.com (smtp03.primenet.com [206.165.6.133]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id AAA14868; Thu, 5 Feb 1998 00:55:32 -0800 (PST) (envelope-from tlambert@usr08.primenet.com) Received: (from daemon@localhost) by smtp03.primenet.com (8.8.8/8.8.8) id BAA11646; Thu, 5 Feb 1998 01:55:26 -0700 (MST) Received: from usr08.primenet.com(206.165.6.208) via SMTP by smtp03.primenet.com, id smtpd011623; Thu Feb 5 01:55:19 1998 Received: (from tlambert@localhost) by usr08.primenet.com (8.8.5/8.8.5) id BAA13565; Thu, 5 Feb 1998 01:55:16 -0700 (MST) From: Terry Lambert Message-Id: <199802050855.BAA13565@usr08.primenet.com> Subject: Re: character-set information for terminals. To: j_mini@efn.org Date: Thu, 5 Feb 1998 08:55:15 +0000 (GMT) Cc: tlambert@primenet.com, hackers@FreeBSD.ORG, questions@FreeBSD.ORG In-Reply-To: <19980204234005.30868@micron.mini.net> from "Jonathan Mini" at Feb 4, 98 11:40:05 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe hackers" > > 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.