title: How to get base64 encoding the same for AutoIt and PowerShell?
body: <p>I use <a href="http://www.autoitscript.com/forum/topic/121985-autoit-machine-code-algorithm-collection/" rel="nofollow noreferrer">Ward's AutoIt Machine Code Algorithm Collection</a> to get base64 encoding of a string in AutoIt:</p>
  
  <pre><code>#Include "Base64.au3"
  
  Dim $Encode = _Base64Encode("ps")
  MsgBox(0, 'Base64 Encode Data', $Encode)
  </code></pre>
  
  <p>The result:</p>
  
  <pre><code>cHM=
  </code></pre>
  
  <p>PowerShell code to get the base64 encoding of the same string "ps":</p>
  
  <pre><code>$commands = 'ps'
  $bytes = [System.Text.Encoding]::Unicode.GetBytes($commands)
  $encodedString = [Convert]::ToBase64String($bytes)
  $encodedString
  </code></pre>
  
  <p>What I got is:</p>
  
  <pre><code>cABzAA==
  </code></pre>
  
  <p>The result from PowerShell is what I want. How to get the same result using AutoIt? I guess this is a character encoding issue.</p>