From 758195cb791556c3f5268e7e075f3ab55bcd5e90 Mon Sep 17 00:00:00 2001
From: LE Manh Cuong <manhcuongle@hotmail.com>
Date: Mon, 28 Sep 2015 16:05:22 +0700
Subject: Encode64 Plugin - Fix wrong `echo` usage

Currently, encode64 plugin using `echo -n` to print the content
of $1 variable. This approach will not work with arbitrary data,
which contains sequence of escaped characters, since when many
`echo` implementation will expand them.

This commit chage the usage to `printf`, which is builtin in all
POSIX shells and can print arbitrary data reliability.
---
 plugins/encode64/encode64.plugin.zsh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'plugins/encode64/encode64.plugin.zsh')

diff --git a/plugins/encode64/encode64.plugin.zsh b/plugins/encode64/encode64.plugin.zsh
index 4dbd1b453..53de6478a 100644
--- a/plugins/encode64/encode64.plugin.zsh
+++ b/plugins/encode64/encode64.plugin.zsh
@@ -1,4 +1,4 @@
-encode64(){ echo -n $1 | base64 }
-decode64(){ echo -n $1 | base64 --decode }
+encode64(){ printf '%s' $1 | base64 }
+decode64(){ printf '%s' $1 | base64 --decode }
 alias e64=encode64
 alias d64=decode64
-- 
cgit v1.2.3-70-g09d2