From 8f25b4c862395b4e399b757752ec9636a2686fdd Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Sun, 21 Oct 2012 22:46:39 +0200 Subject: [PATCH] using Uint8Array instead of Uint16Array --- third-party/ab-str.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/third-party/ab-str.js b/third-party/ab-str.js index 2bba23b..2d7b4e9 100644 --- a/third-party/ab-str.js +++ b/third-party/ab-str.js @@ -3,14 +3,17 @@ // http://updates.html5rocks.com/2012/06/How-to-convert-ArrayBuffer-to-and-from-String // http://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers // +// Edited by Rodolphe Breard +// - Using Uint8Array instead of Uint16Array +// function ab2str(buf) { - return String.fromCharCode.apply(null, new Uint16Array(buf)); + return String.fromCharCode.apply(null, new Uint8Array(buf)); } function str2ab(str) { - var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char - var bufView = new Uint16Array(buf); + var buf = new ArrayBuffer(str.length); + var bufView = new Uint8Array(buf); for (var i=0, strLen=str.length; i