My actual file name is "парламент.xls".
But I am unable to get the same file name in java
. It was coming something strange like ???????.xls
The problem is coming for the non-latin words and characters.
How to use my actual file name without being changed.
I tried from my side. Please refer to my below code:
String escaped_source = StringEscapeUtils.escapeJava(filename);
String encoded = new String(filename.getBytes("UTF-16"), "ISO-8859-1");
System.out.println("escaped_source------------>"+escaped_source);
System.out.println("encoded------------>"+encoded);
String abc = StringEscapeUtils.unescapeJava(escaped_source);
System.out.println("abc------------>"+abc);
Output: escaped_source------------
>\u043F\u0430\u0440\u043B\u0430\u043C\u0435\u043D\u0442.xls
encoded------------>þÿ?0@;0<5=B
abc------------>?????????.xls