From 133496cd12439e1f1e45578adb9ae205a986bec2 Mon Sep 17 00:00:00 2001 From: Victor Costan Date: Thu, 13 Sep 2012 02:08:20 -0300 Subject: [PATCH] Fix btoa to match browser implementations Test case: btoa(String.fromCharCode(252)) should return "/A==" --- btoa/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btoa/index.js b/btoa/index.js index 8bfc1ad..350cd4b 100644 --- a/btoa/index.js +++ b/btoa/index.js @@ -2,7 +2,7 @@ "use strict"; function btoa(str) { - return new Buffer(str, 'utf8').toString('base64'); + return new Buffer(str, 'binary').toString('base64'); } module.exports = btoa;