title: PowerShell out-file: prevent encoding changes
body: <p>I'm currently working on some search and replace operation that I'm trying to automate using powershell. Unfortunately I recognized yesterday that we've different file encodings in our codebase (UTF8 and ASCII). Because we're doing these search and replace operations in a different branch I can't change the file encodings at this stage. </p>
  
  <p>If I'm running the following lines it changes all files to UCS-2 Little Eindian even though my default powershell encoding is set to iso-8859-1 (Western European (Windows)).</p>
  
  <pre><code>$content = Get-Content $_.Path
  $content -replace 'myOldText' , 'myNewText' | Out-File $_.Path
  </code></pre>
  
  <p>Is there a way to prevent powershell from changing the file's encoding? </p>