I've got the following method to write HTTP response to browser socket.
public static void writeResponse(OutputStream os, HttpResponse response)
throws IOException {
String total = just my http response text;
os.write(total.getBytes());
//os.write(new String(total.getBytes(ISO_8859_1), UTF_8).getBytes()); - my try
os.flush();
}
Charset is charset=UTF-8. Content type is text/plain.Text output text is
"Hello-eng\nПривет-rus\nこんにちは-jap\nनमस्ते-hind\nأهلا-arab"
But my browser can not read anything except English.
Hello-eng ������-rus ?????-jap ??????-hind ????-arab
What is wrong?
os.write(total.getBytes(UTF_8));