title: How to set encoding for a herestring/heredoc in powershell?
body: <p>I'm attempting to update the hosts file on a Windows server and trying to do it using a heredoc in powershell.</p>
  <p>I can't figure out why my result has extra spaces between every character in each hosts entry.</p>
  <p>I'm porting some scripting from Linux.</p>
  <pre><code>PS C:\Users\Administrator&gt; cat C:\Users\Administrator\AppData\Local\Temp\etchosts.ps1
  @&quot;
  127.0.0.1 src.example.com
  127.0.0.2 builds.example.com
  127.0.0.3 ti.example.com
  127.0.0.4 jira.example.com
  &quot;@ &gt;&gt;C:\Windows\System32\drivers\etc\hosts
  
  
  
  PS C:\Users\Administrator&gt; powershell C:\Users\Administrator\AppData\Local\Temp\etchosts.ps1
  PS C:\Users\Administrator&gt; cat C:\Windows\System32\drivers\etc\hosts
  # Copyright (c) 1993-2009 Microsoft Corp.
  #
  # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
  #
  # This file contains the mappings of IP addresses to host names. Each
  # entry should be kept on an individual line. The IP address should
  # be placed in the first column followed by the corresponding host name.
  # The IP address and the host name should be separated by at least one
  # space.
  #
  # Additionally, comments (such as these) may be inserted on individual
  # lines or following the machine name denoted by a '#' symbol.
  #
  # For example:
  #
  #      102.54.94.97     rhino.acme.com          # source server
  #       38.25.63.10     x.acme.com              # x client host
  
  # localhost name resolution is handled within DNS itself.
  #       127.0.0.1       localhost
  #       ::1             localhost
   1 2 7 . 0 . 0 . 1   s r c . e x a m p l e . c o m
  
   1 2 7 . 0 . 0 . 2   b u i l d s . e x a m p l e . c o m
  
   1 2 7 . 0 . 0 . 3   t i . e x a m p l e . c o m
  
   1 2 7 . 0 . 0 . 4   j i r a . e x a m p l e . c o m
  </code></pre>
  <p>I expected no spaces between all the characters.
  If there is a &quot;Windows&quot; way to do this, I would appreciate any input/suggestions.</p>