"unicode.txt" UTF-8 file
アफਸᙡşüabÇİÜ⏩ア
The first character has 4 bytes. And when I run this code, I can't get the output that I expect
InputStream in = new FileInputStream("unicode.txt");
InputStreamReader inReader = new InputStreamReader(in, "UTF-8");
char ch = (char)inReader.read();
System.out.println(ch); // Writes '?' character to the console. Why ?
Why this code doesn't write '' character to the console ? And How can I write it ?
My default encoding:
System.out.println(System.getProperty("file.encoding")); // output: "UTF-8"
System.out.println(Charset.defaultCharset()); // output: "UTF-8"
I think, the problem is char data type.
Thanks.