in reply to Re: Removing Bad Characters from a String
in thread Removing Bad Characters from a String

unless this is a windows machine, in which case there are more 'bad characters'

From a windows error message:

A filename cannot contain any of the following characters:
/ : * ? " < > |
  • Comment on Re^2: Removing Bad Characters from a String

Replies are listed 'Best First'.
Re^3: Removing Bad Characters from a String
by ambrus (Abbot) on May 09, 2005 at 06:02 UTC

    That's the list for NTFS, in FAT, more characters are banned. On the top of my head, I think the additional ones are \x20 + = [ ] %

    I think that control characters (\x00-\x1f but not \x7f IIRC) and backslash (\\) are also banned in filenames, despite that error message not mentioning them.

      actually, i'm not sure about your assertion that those additional characters are banned in FAT. i'm running on my parents' win 98 machine, which has a FAT filesystem (i first assumed, but then i checked, and it is FAT). i successfully named a file 'a[0] += 7 % 3.txt'. this is also the OS i got my error message from.
      i'd upload a small image as proof, but i'm not really sure how.

        I think you are right. Those extended characters are allowed in windows long filenames (vfat). I think however that DOS 6 does not allow any of them.

Re^3: Removing Bad Characters from a String
by merlyn (Sage) on May 09, 2005 at 01:33 UTC
      LOL and ++ from me, but it's weird hearing this from one of the co-authors of Learning Perl on Win32 Systems...

      Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')

      Don't fool yourself.
        one of the co-authors of Learning Perl on Win32 Systems
        That would get even weirder if I told you the history of the book.

        As in, I didn't even know that book was being worked on until I got my complimentary stack of 10 at my home office. And then I did one of those "double-takes" you see on sitcoms.

        And then people asked me "what's the difference between that and Learning Perl, 2ed?", to which I necessarily replied, "I dunno... I worked on the parts that are the same, not the parts that are different."

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.