How to decode a Base64 string?

后端 未结 5 572
旧时难觅i
旧时难觅i 2020-12-24 04:38

I have a normal string in Powershell that is from a text file containing Base64 text; it is stored in $x. I am trying to decode it as such:

$z =         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 05:22

    I had issues with spaces showing in between my output and there was no answer online at all to fix this issue. I literally spend many hours trying to find a solution and found one from playing around with the code to the point that I almost did not even know what I typed in at the time that I got it to work. Here is my fix for the issue: [System.Text.Encoding]::UTF8.GetString(([System.Convert]::FromBase64String($base64string)|?{$_}))

提交回复
热议问题