I'm reading a file which is in unicode using java.
but whenever I try to read this using UTF-8 or UTF-16 in java it reads english words correctly but can not read other words which are in gujarati language. It gives ????? only. I had the same problem which I have asked here. but no one answered, so changed my approach. I read the data from the MS SQL database having column nvarchar(for Gujarati language) and stored it in a file, and now trying to read the data from the file using java. But still not getting it.
I tried changing encoding of my file to UTF-8 and unicode big endian and I've tried all the unicode formats supported in java8 but not getting the desired result.
this is my code of java:
File fileDir = new File("C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python35\\data.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fileDir),"UTF-16"));
String str;
while ((str = in.readLine()) != null) {
System.out.println(str);
}
in.close();
I directed this data to my android application through a socket connection. I'm trying to show it on textview but it is also giving me a "???" signs..
And I've tried showing gujarati language on textview directly with textview.setText("તારુ નામ શુ છે ?")
and it shows correctly !!!..
When I try to send a hard coded string from java through a socket connection (String is same as written above) it raises this error:
fileread.java:23: error: unmappable character for encoding Cp1252 ds.writeBytes("α¬ñα¬╛α¬░α½? નα¬╛ᬫ α¬╢α½? છα½ç ?");