title: Different output between Powershell ToBase64String & Linux base64
body: <p>SGVsbG8sIHdvcmxkIQ== I have to write two scripts, one for Windows Server and another for Ubuntu Server. To illustrate, if my bash script runs:</p>
  
  <pre><code>echo -n 'BASE64' | base64
  </code></pre>
  
  <p>the result is <code>QkFTRTY0</code>. If my PowerShell Script runs:</p>
  
  <pre><code>[System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes('BASE64'))
  </code></pre>
  
  <p>the result is <code>QgBBAFMARQA2ADQA</code>. Is important get the same PowerShell string in Linux. Anybody knows why this difference and some solution to my problem? I think that the problem is related to Unix's UTF-8 encoding, but I can't find a solution. I can decode the PowerShell output in Linux, but I can't encode a string in Linux and get the same result as PowerShell. A bash solution is optimal, but a C/C++ code solution or guide works too.</p>