fpschultze / Base64

PowerShell module that simplifies base64 encoding and decoding

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Always uses UTF16

felixfbecker opened this issue · comments

Most tools use UTF8 (and it's the default in PowerShell 6), but this module always uses [System.Text.Encoding]::Unicode (UTF16) instead of [System.Text.Encoding]::UTF8.
So trying something like this:

(kubectl get secret database -o json | ConvertFrom-Json).data.password | ConvertFrom-Base64String

Will print a bunch of random chinese characters instead of the actual value, while this will work correctly:

(kubectl get secret database -o json | ConvertFrom-Json).data.password | base64 --decode

I would propose a -Encoding parameter.

Good catch! I'll fix it