diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-11-18 15:18:06 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-11-18 15:18:06 -0800 |
commit | 6ff12c425e83522a72841f9966eefbe9a1eefc37 (patch) | |
tree | 53b56fda782daebafc12ade3dcfe19c81d53d6ff /lib/querystring.js | |
parent | 57d817290649a53472664cd266d5f756e8e59e95 (diff) | |
download | node-new-6ff12c425e83522a72841f9966eefbe9a1eefc37.tar.gz |
Add querystring.unescapeBuffer
Diffstat (limited to 'lib/querystring.js')
-rw-r--r-- | lib/querystring.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/querystring.js b/lib/querystring.js index d7c642f101..8015469636 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -10,7 +10,7 @@ function charCode (c) { // a safe fast alternative to decodeURIComponent -QueryString.unescape = function (s, decodeSpaces) { +QueryString.unescapeBuffer = function (s, decodeSpaces) { var out = new Buffer(s.length); var state = "CHAR"; // states: CHAR, HEX0, HEX1 var n, m, hexchar; @@ -72,7 +72,12 @@ QueryString.unescape = function (s, decodeSpaces) { // TODO support returning arbitrary buffers. - return out.toString('utf8', 0, outIndex-1); + return out.slice(0, outIndex-1); +}; + + +QueryString.unescape = function (s, decodeSpaces) { + return QueryString.unescapeBuffer(s, decodeSpaces).toString(); }; |