Making a string, file-safe (file-encode??)



I was wondering if there was a quick way to ensure that a filename is
a safe.

What I mean is that if I am creating a file from a string variable, I
want to ensure that the file will actually be able to be created. So
if it contains a "?", then clearly I would want to eliminate it.

I know that there is something like URL encode that encodes strings
for use in urls, but is there another function that works similarly
for strings for files that I want to create?

Thanks!
.



Relevant Pages

  • Re: Making a string, file-safe (file-encode??)
    ... a safe. ... I know that there is something like URL encode that encodes strings ... The characters that are invalid are system specific, and some systems don't have limitations at all. ...
    (comp.lang.java.programmer)
  • Re: Forward slashes in filenames
    ... >> for all the strings in temp.txt and replaces all those strings with ... character in a filename or directory record with '/', ... I think Grunff might want to say which kernel he's running. ... What would really help me here is the ISO file generated from the ...
    (comp.os.linux.misc)
  • Re: Why does rewind() ignore errors?
    ... No. I'm saying you can never make it 'as safe as possible'. ... arrays, hashes and other safe libraries sitting on back burners, but I ... programming semantics that provide alternatives to other unsafe ... I might even consider counted strings, ...
    (comp.std.c)
  • Re: ID3 Tags (#136)
    ... this script assumes Ruby 1.8.6 style handeling of strings. ... #usage id3.rb filename ...
    (comp.lang.ruby)
  • Re: non-constant strings
    ... to bypass object encapsulation paradigm and break object integrity. ... def initialize ... that a command is safe. ... You mean mutable strings. ...
    (comp.lang.ruby)