Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Won't Fix
-
None
-
None
-
None
Description
It would be nice if StringEscapeUtils could take any string (include with backslash, forward slash, tab, CR, LF, extended unicode chars,...) and turn it into a valid filename, escaping the 'invalid' characters.
Implementation might be OS-dependent or simply escape all characters which are invalid in at least one of the major OS (Unix/Windows/Mac)
Rationale: it is quite common to receive uncontrolled text (from Web form, from mail parsing, ...) and need to turn it into some part of file/folder name (to create some workspace, archive data,...) which 'ressemble' (and +/- human readable) to the original free text.
Could be very similar to escapeHtml(): replace each invalid char by %HexCodeOfChar - only the list of 'invalid chars' would be different.