Ethereal-dev: Re: [Ethereal-dev] Problem printing broken TFTP packets

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Santeri Paavolainen <santtu@xxxxxxx>
Date: Wed, 10 Apr 2002 09:07:22 +0300 (EEST)
On Tue, 9 Apr 2002, Guy Harris wrote:
> On Tue, Apr 09, 2002 at 09:58:07AM +0300, Santeri Paavolainen wrote:
> > I made a quick patch which adds text_clean_string and modifies
> > ps_clean_string to change characters in range 000 to 037 into ^@ to ^Z
> > (two characters, "^" + "[@-Z]").
> 
> Any reason not to use "isprint()", instead?

isprint(3) is (IMHO) inadequate, since it depends on the current locale
setting. What we're interested is what characters are usable for
*printing*, not displaying in the current screen/terminal..

In this patch I just try to avoid the worst case eg. when printer goes
haywire because it finds some embedded control codes in the data stream.  
It does not ensure that the printed data even remotely resembles what is
on screen (due to different font mappings on postscript printers, for
example).

Anyway, if ethereal is ever localized (or is it already?), then we'll have
anyway more problems with the printing since the printing has to be
locale-aware also --- think about if all the label text have been
localized to japanese, then the printer routine cannot just take
UTF-8/whatever encoded label and hope it would print ok without first
setting proper fonts and font-specific encoding on a postscript printer.

-- 
santtu@xxxxxx                    I have become death, destroyer of the worlds.