patch for replacing non-printable chars in filenames

Paul Slootman paul at debian.org
Fri Nov 26 09:38:06 GMT 2004


On Fri 26 Nov 2004, Stefan Nehlsen wrote:
> On Tue, Nov 23, 2004 at 05:29:57PM +0100, Paul Slootman wrote:
> > +            /* Replace non-printing chars in the string, most probably due to
> > +             * wierd filenames. Skip the first and last chars, they may be \n */
> > +            int i;
> > +            for (i=1; i<len-1; i++)
> > +                if (!isprint(buf[i]))
> > +                        buf[i] = '?';
> 
> Is looping over strings a good idea in times of UTF-8?

It is if you don't know the strings are in UTF-8, and you want to
prevent "garbage" chars reaching the tty (the whole point of this
exercise :-)


Paul Slootman


More information about the rsync mailing list