ExportFileNameEncoder { public static String encodeZipFileName( String fileName ) { try { return URLEncoder.encode( fileName, "UTF-8" ).replace( "*", "%2A" ); } catch ( UnsupportedEncodingException e ) { e.printStackTrace(); return fileName; } }  static String encodeZipFileName( String fileName ); static String decodeZipFileName( String encodedFileName ); static String encodeZipPathName( String path ); static String decodeZipPath( String encodedPath );  }
@Test public void testEncodeZipFileName() { assertEquals( "", ExportFileNameEncoder.encodeZipFileName( "" ) ); assertEquals( "simpleFileName.extention", ExportFileNameEncoder.encodeZipFileName( "simpleFileName.extention" ) ); assertEquals( "two+words", ExportFileNameEncoder.encodeZipFileName( "two words" ) ); assertEquals( "special+characters%3A%28%2B%29%25%5E", ExportFileNameEncoder.encodeZipFileName( "special characters:(+)%^" ) ); }