title: Edit .XML file with Powershell, encoding
body: <p>I need to edit a .xml file with powershell. The thing I need to do is to download the .xml file from the server, updated the version number, and then save it in my local computer. This is what I did.</p>
  
  <pre><code>[xml]$myXML = get-content $xmlFileServer
  $myXML.'ivy-module'.info.revision = $newVersion
  $myXML.Save($newXMLFileName)
  </code></pre>
  
  <p>Then I will have a new xml file in my local computer. However, I doubt the coding is different since I can't process with this .xml file.
  The .xml I should get is something like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" xmlns:e="http://ant.apache.org/ivy/extra"&gt;
    &lt;info organisation="XXXX" module="XXXX" revision="2.0.1.0" status="release" publication="20131119202217" /&gt;
    &lt;publications&gt;
      &lt;artifact name="XXXX" type="dll" ext="zip" conf="*" /&gt;
    &lt;/publications&gt;
  &lt;/ivy-module&gt;
  </code></pre>
  
  <p>However, after editing with powershell, the .xml contains some hidden info. I tried to open  with NotePad++, I got something like this:</p>
  
  <pre><code>ï»¿&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" xmlns:e="http://ant.apache.org/ivy/extra"&gt;
    &lt;info organisation="XXXX" module="XXXX" revision="2.0.1.0" status="release" publication="20131119202217"/&gt;
    &lt;publications&gt;
      &lt;artifact name="XXXX" type="dll" ext="zip" conf="*"/&gt;
    &lt;/publications&gt;
  &lt;/ivy-module&gt;
  </code></pre>
  
  <p>Can anyone tell me why is the situation? 
  Thank you so much.</p>