in my server code:
pw = new PrintWriter(stream);
br = new BufferedReader(new InputStreamReader(
socket.getInputStream(), "UTF-8"));
in my client code
BufferedReader br = new BufferedReader(new InputStreamReader(
clientSocket.getInputStream(), "UTF-8"));
OutputStreamWriter stream = new OutputStreamWriter(clientSocket.getOutputStream(), "UTF-8");
PrintWriter pw = new PrintWriter(stream);
then at first, server use: pw.println("OK"); pw.flush();
client receive OK
After that, server use:
pw.println("TRUE")
pw.flush();
this time, client receive a string that has unknow char
\ufffd\ufffdTRUE
then i keep send msg to client and it will receive some \ufffd before every sentence.
Could anybody help me solve the problem?