Beware when base64-encoding on the CLI using echo

Recently I needed to base64-encode a string. To do this I turned to the CLI and piped the output of echo to base64. # Don’t use! Correct command further down this post. $ echo ‘test’ | base64 dGVzdAo= Although the output looks quite good, things didn’t quite work out when using the string: it failed …