public static String encode ( String str ) { String encoded ; try { encoded = URLEncoder . encode ( str , "UTF-8" ) . replace ( "." , "%2E" ) . replace ( "*" , "%2A" ) ; } catch ( UnsupportedEncodingException e ) { // Should never happen encoded = str ; } return encoded ; }
Protect passed String to work with as much filesystems as possible .