Notepad++ just guesses the encoding since there is no way to magically tell what it is exactly. Since you don't show what stringifiedKeywordingObject
is, my guess is that it's an ASCII string. An ASCII string is the same in any ANSI encoding as well as in UTF-8, so there is no way for Notepad++ to tell.
There is one magical way to detect UTF-8, though. It's called Byte Order Mark (BOM). But since byte order doesn't make any sense for UTF-8, Unicode standard neither requires nor recommends BOM use for UTF-8. Some software still like to add it by default, especially Microsoft, which leads to two things: software supporting Unicode automatically detecting UTF-8 (a good thing) and software not supporting Unicode breaking terribly (a bad thing).
OutputStreamWriter
doesn't have a habit of adding BOM, so Notepad++ has no way of detecting your encoding. Try writing some characters like é
, あ
, א
or б
and see if it changes. Notepad++ may then try to guess the encoding by looking at the contents. But since it's heuristics, it may fail (for example, for large files it may not look far enough if the beginning is in plain English, or it may falsely detect something as UTF-8 because the character codes are similar).
This whole encoding thing is a real historical mess, so it isn't supposed to make any sense. It's just the way it is.