title: Powershell Invalid length for a Base-64 char array
body: <p>I have this script which downloads a base64 encoded text and tries to decode it.</p>
  
  <p>In the meanwhile my script goes like this:</p>
  
  <pre><code>powershell.exe "set-ExecutionPolicy unrestricted ; $WebClient = New-Object net.WebClient ; $string$WebClient.DownloadString('http://127.0.0.1:1234/b64.txt'); [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($string))"
  </code></pre>
  
  <p>The download part works very well, though, the decode part seems to give the following exception:</p>
  
  <pre><code>Exception calling "FromBase64String" with "1" argument(s): "Invalid length for
  a Base-64 char array."
  At line:1 char:222
  + set-ExecutionPolicy unrestricted ; $WebClient = New-Object net.WebClient ; $s
  tring = $WebClient.DownloadString('http://127.0.0.1:1234/b6464.txt'); [System.
  Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String &lt;&lt;&lt;&lt; ($string
  ))
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : DotNetMethodException
  </code></pre>
  
  <p>Any clue why this is happening? Many Thanks!!!</p>