tag 26372 notabug
close 26372
stop

Hello,

On 04/05/2017 06:39 AM, Goulven Guillard wrote:
> It seems `base64` inserts a carriage return ("Cg==") when encoding a
> string :
> 
> $ echo foobar|base64
> Zm9vYmFyCg==

Not exactly - it is "echo" which adds the newline and base64 simply
encodes all its input.

Observe the following:

  $ echo foobar | od -c
  0000000   f   o   o   b   a   r  \n
  0000007

"printf" can be used for finer control over
your printed strings - it will not add newline
unless you request it:

  $ printf foobar | base64
  Zm9vYmFy
  $ printf 'foobar\n' | base64
  Zm9vYmFyCg==

As such I'm closing this bug report, but discussion can continue
by replying to this thread.

regards,
 - assaf




Reply via email to