Olivier Vierlinck created LANG-918:
--------------------------------------

             Summary: Extend StringEscapeUtils with escapeFilename() method
                 Key: LANG-918
                 URL: https://issues.apache.org/jira/browse/LANG-918
             Project: Commons Lang
          Issue Type: Improvement
          Components: lang.*, lang.text.*
            Reporter: Olivier Vierlinck
            Priority: Minor


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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to