You need to use the response character maker rather than the byte output stream.
Replace
ServletOutputStream os = res.getOutputStream(); os.print("Hello World"); os.flush(); os.close();
by
res.getWriter().write("Some UTF-8");
In addition, I would recommend setting the content type to text/plain , and not too general, which implies binary content, not the content of the character.
I'm not sure about Notepad ++, but in Notepad, if a text document does not contain any characters beyond ANSI, it will be interpreted as ANSI. Do not be fooled by this behavior.
Balusc
source share