GNU bug report logs - #26372
Base64 inserts carriage return

Previous Next

Package: coreutils;

Reported by: Goulven Guillard <lecotegougdelaforce <at> free.fr>

Date: Wed, 5 Apr 2017 15:27:02 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 26372 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Goulven Guillard <lecotegougdelaforce <at> free.fr>, 26372 <at> debbugs.gnu.org
Subject: Re: bug#26372: Base64 inserts carriage return
Date: Wed, 5 Apr 2017 11:42:34 -0400
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





This bug report was last modified 8 years and 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.