Test for invalid unicode in file name

Ken O. Burtch kburtch-Zd07PnzKK1IAvxtiuMwx3w at public.gmane.org
Fri May 6 17:47:23 UTC 2005


Sorry.  Only good for pathnames, isn't it? :-)

KB

On Fri, 2005-05-06 at 13:43, Ken O. Burtch wrote:
> Hello,
> 
> To do this is a portable way, Linux has a command called pathchk which
> can be used to both verify that a path exists and can verify that the
> pathname is POSIX-complaint (no strange characters, etc.).  You can run
> this command from Perl with backquotes.
> 
> For more info on pathchk, buy my book "Linux Shell Scripting with Bash"
> and see pg. 170.  Or, slightly cheaper, type "man pathchk".
> 
> Ken B.
> 
> On Thu, 2005-05-05 at 22:20, Madison Kelly wrote:
> > Hi all,
> > 
> >    I've run into a problem where a bulk postgres "COPY..." statement is 
> > dieing because one of the lines contains a file name with an invalid 
> > unicode character. In nautilus this file has '(invalid encoding)' and 
> > the postgres error is 'CONTEXT:  COPY file_info_3, line 228287, column 
> > file_name: "Femme Fatal\uffff.url"'.
> > 
> >    Is there a way in perl (something like 'stat') where I can check to 
> > make sure a file name has valid encoding? If there is than I can catch 
> > this problem before adding it to, and corrupting, my COPY statement? I 
> > already 'quote' the file names first but that didn't catch it.
> > 
> >    Thanks!
> > 
> > Madison
> > 
> > PS - I posted this on TPM for anyone subscribed to there but I didn't 
> > get any replies so I am hoping for better luck here. :p
> 
> --
> The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
> TLUG requests: Linux topics, No HTML, wrap text below 80 columns
> How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list