in reply to Escaping special characters in filename for Net::SCP

As far as the remote sshd machine is NT It seems impossible filename creation:
" The following are the illegal NTFS characters: " / \ * ? < > | :
Which does not mean that these chars cannot be replaced with valid ones.


  • Comment on Re: Escaping special characters in filename for Net::SCP

Replies are listed 'Best First'.
Re^2: Escaping special characters in filename for Net::SCP
by jhourcle (Prior) on Mar 25, 2005 at 20:00 UTC

    If I'm sanitizing strings, I typically just replace everything that I don't like with an underscore:

    s/[^a-zA-Z0-9.\-]/_/g;

    Please note -- I specifically deal with a negated class that contains the acceptable characters, rather than trying to maintain a list of which potentially bad characters I might have to deal with, to ensure that I don't miss anything that might be bad.

    If you had to ensure the process was reversable in the future, I'd use something similar to URI encoding. (although probably not URI encoding, as I don't trust % normally.)

Re^2: Escaping special characters in filename for Net::SCP
by blazar (Canon) on Mar 26, 2005 at 08:25 UTC
    Nope. Linux 2 Linux. And that's not the actual problem which appearently lies in some shell interaction as explained some more in detail in another node of this thread. TY in any case...