[BUG] node.http.ServerRequest.setBodyEncoding('ascii') not working?

144 views
Skip to first unread message

Felix Geisendörfer

unread,
Aug 5, 2009, 9:56:21 PM8/5/09
to nodejs
Hey Ryan,

it seems like the 'ascii' encoding for ServerRequest.setBodyEncoding()
does not work. At least it seems to return the same output as 'raw'
does for me.

req.setBodyEncoding('ascii');
req.addListener('body', function(chunk) {
p(chunk); // outputs an array of bytes
})

-- Felix Geisendörfer aka the_undefined

ryan dahl

unread,
Aug 6, 2009, 7:38:15 AM8/6/09
to nod...@googlegroups.com
Fixed in 216fb3b9b2811444228d7af7a450839e58b80713.

Felix Geisendörfer

unread,
Aug 8, 2009, 3:08:59 PM8/8/09
to nodejs
Hey Ryan,

sorry, I was gone for the past 2 days. The patch you pushed doesn't
seem to resolve the issue I'm experiencing. However, if you apply the
test below to test-http.js you should be able to reproduce the issue.

-- Felix Geisendörfer aka the_undefined

From 2f4a2ea4bb1cb2886a71de09f45e506807cffe40 Mon Sep 17 00:00:00 2001
From: Felix Geisendörder <fe...@debuggable.com>
Date: Sat, 8 Aug 2009 15:06:30 -0400
Subject: [PATCH] Demonstrate node.http.ServerRequest.setBodyEncoding
('ascii') still no working

---
test/mjsunit/test-http.js | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/test/mjsunit/test-http.js b/test/mjsunit/test-http.js
index 83c8a36..94a1905 100644
--- a/test/mjsunit/test-http.js
+++ b/test/mjsunit/test-http.js
@@ -34,7 +34,7 @@ function onLoad () {
req.finish(function (res) {
assertEquals(200, res.statusCode);
responses_recvd += 1;
- res.setBodyEncoding("utf8");
+ res.setBodyEncoding("ascii");
res.addListener("body", function (chunk) { body0 += chunk; });
node.debug("Got /hello response");
});
--
1.6.0.4

r...@tinyclouds.org

unread,
Aug 10, 2009, 4:15:04 AM8/10/09
to nodejs
Thank you! Fixed in 75fc21537a408135a0147f97a9ef0de800bbbfc8.
Reply all
Reply to author
Forward
0 new messages