bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26372: Base64 inserts carriage return


From: Assaf Gordon
Subject: bug#26372: Base64 inserts carriage return
Date: Wed, 5 Apr 2017 11:42:34 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

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

[Prev in Thread] Current Thread [Next in Thread]