[oclug] Terminal beeing corrupted by my software
Rod Giffin
rod at giffinscientific.com
Fri Nov 14 10:04:47 EST 2003
Matthew Wilcox said:
> On Thu, Nov 13, 2003 at 04:54:46PM -0500, psaz at rogers.com wrote:
>> I wrote up some software to quickly display the contents of
>> blocks on the hard drive (for data retreival). I've
>> attempted some quick filters to try and weed out binary
>> blocks, but they arent alwlays sucessful.
>>
>> In any case, usually, when a binary block is displayed, the
>> whole character set of my terminal is corrupted. No letters
>> are displayed anymore...usually they are replaced with
>> members of the extended ascii character set.
>>
>> I have to logout and log back in to restore the character
>> set.
>>
>> I can live with the bug, I'm just curious what could
>> corrupt the character set like that. In some cases it even
>> disables my number pade (numlock stops responding also).
>
> It's not a bug, it's a feature ;-)
>
> Terminals, be they xterms, the Linux Console or minicom usually emulate
> some variant of a DEC VT100 terminal. Some codes are defined to be
> control codes and will do things like switching character sets and
> disabling various keys.
>
> What you'd do in C is call iscntrl() for each character. I don't know
> how you go about filtering out control characters in perl.
Probably pretty much the same way, there is a lib called perlclib that
contains a section of character class tests. You can then use a standard
character map to locate a suitable string sequence to represent
non-printable characters in the output. This gives you a lot of output
options, including formatting the output in special ways.
Rod.
More information about the OCLUG
mailing list