@@ -107,23 +107,21 @@ private void createRow(Sheet sheet, List<String> cellList, int rowNum) {
107107	}
108108
109109	private  enum  FileNameEncoder  {
110- 		IE (Browser .IE , ( it )  -> {
110+ 		IE (Browser .IE , it  -> {
111111			try  {
112112				return  URLEncoder .encode (it , StandardCharsets .UTF_8 .name ()).replaceAll ("\\ +" , "%20" );
113113			} catch  (UnsupportedEncodingException  e ) {
114114				return  it ;
115115			}
116116		}),
117- 		FIREFOX (Browser .FIREFOX , FileNameEncoder . simpleEncodeFunction ),
118- 		OPERA (Browser .OPERA , FileNameEncoder . simpleEncodeFunction ),
119- 		CHROME (Browser .CHROME , FileNameEncoder . simpleEncodeFunction ),
117+ 		FIREFOX (Browser .FIREFOX , getDefaultEncodeOperator () ),
118+ 		OPERA (Browser .OPERA , getDefaultEncodeOperator () ),
119+ 		CHROME (Browser .CHROME , getDefaultEncodeOperator () ),
120120		UNKNOWN (Browser .UNKNOWN , UnaryOperator .identity ());
121121
122122		private  final  Browser  browser ;
123123		private  UnaryOperator <String > encodeOperator ;
124124
125- 		private  static  final  UnaryOperator <String > simpleEncodeFunction  = it  -> new  String (it .getBytes (StandardCharsets .UTF_8 ), StandardCharsets .ISO_8859_1 );
126- 
127125		private  static  final  Map <Browser , Function <String , String >> FILE_NAME_ENCODER_MAP ;
128126
129127		static  {
@@ -144,6 +142,10 @@ protected UnaryOperator<String> getEncodeOperator() {
144142			return  encodeOperator ;
145143		}
146144
145+ 		private  static  UnaryOperator <String > getDefaultEncodeOperator () {
146+ 			return  it  -> new  String (it .getBytes (StandardCharsets .UTF_8 ), StandardCharsets .ISO_8859_1 );
147+ 		}
148+ 
147149		public  static  String  encode (Browser  browser , String  fileName ) {
148150			return  FILE_NAME_ENCODER_MAP .get (browser ).apply (fileName );
149151		}
0 commit comments