I have created a java code that will store an uploaded text document. Then I return the text in that file. All the text are in "sinhala" language. UTF-8 encoded text
streamReader = new InputStreamReader(new FileInputStream(new File(filePath)), "utf8" /*Here I have tried 'UTF-8', 'utf-8'*/); br = new BufferedReader(streamReader); PrintStream printStream= new PrintStream(f); while ((line = br.readLine()) != null) { ..... } The output is directly sent to jsp page, there it's shown as '????????????????????????????????'.
Windows 8.1, tomcat and java version 7. I have tested jsp with sinhala characters, they are working. I have added UTF-8, as content type.
PrintStreams and otherOutputStreams don't have an encoding associated with them. That is what I find most suspicious, in fact.OutputStreams are for writing binary data; for character data one should use aWriter.