while doing some exercise on socket programming, I encounter a problem in reading Unicode.
I have tested this line outside by creating a new class that is just to input and output Vietnamese ( Unicode characters ) . And It gives the correct output as I input some Unicode characters such as ă, â, ...
inputLine = new BufferedReader(new InputStreamReader(System.in,StandardCharsets..UTF_8));
But when I attached the above line to my socket programming class, It goes wrong and I cannot find out why.
clientSocket = new Socket(host, portNumber);
inputLine = new BufferedReader(new InputStreamReader(System.in,StandardCharsets..UTF_8));
String temString = inputLine.readLine();
os = new DataOutputStream(clientSocket.getOutputStream());
is = new DataInputStream(clientSocket.getInputStream());
The result of temString in the above is a question mark "?" when I typed in "â", which has an int value of 65533.
Please help me fix this problem. Thanks.