title: Wrong encoding shown in notepad ++ when opening an xml written using XMLStreamWriter in java
body: <p>Facing a strange problem. I have an application in java which writes data to an xml file. This application is part of a bigger project and has multiple dependencies.
  When I open the xml file in notepad ++, wrong encoding is highlighted .
  This is a minimal reproducible example:</p>
  <pre><code> public static void main(String[] args) throws IOException, XMLStreamException {
       OutputStream ostream;
       XMLStreamWriter writer;
       Path path = Paths.get(&quot;C:/encodingissue/711.xml&quot;);
      ostream = Files.newOutputStream(path);
      XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newFactory();
      writer = xmlOutputFactory.createXMLStreamWriter(ostream,  &quot;ISO-8859-1&quot;);
      writer.writeStartDocument(&quot;ISO-8859-1&quot;, &quot;1.0&quot;);
        writer.writeStartElement(&quot;county&quot;);
        writer.writeCharacters(&quot;bærum&quot;);
        writer.writeEndElement(); 
        writer.close();
        ostream.close();
  }
  </code></pre>
  <p>Strange thing is, there was a new branch cut out few days back. When I execute the above code in the old branch, no issues. Notepad ++ shows ISO-8859. I compared the code with previous branch. no change there. Any idea what could be the issue? spend 2 days, no clue ..
  <a href="https://i.stack.imgur.com/saSDf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/saSDf.png" alt="enter image description here" /></a></p>
  <p>wrong encoding: <a href="https://i.stack.imgur.com/5KozI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5KozI.png" alt="enter image description here" /></a></p>