From a683f296f6f66909d4baee982acb00987937a5c9 Mon Sep 17 00:00:00 2001 From: Travis Reeder Date: Mon, 13 Sep 2010 12:41:28 -0700 Subject: [PATCH] Hi I'm having problems posting data containing multibyte chars using net/http. I found an old bug in the ruby 1.9 bug tracker that was resolved by switching body.length to body.bytesize. The same thing needs to be done in the http_connection gem. http_connection-1.3.0/lib/net_fix.rb line 94 contains: self.content_length = body.length it should be changed to: self.content_length = body.bytesize to work with multi byte chars. / Jonas --- lib/net_fix.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net_fix.rb b/lib/net_fix.rb index ad54f8a..8341afb 100644 --- a/lib/net_fix.rb +++ b/lib/net_fix.rb @@ -91,7 +91,7 @@ def exec(sock, ver, path, send_only=nil) #:nodoc: internal use only private def send_request_with_body(sock, ver, path, body, send_only=nil) - self.content_length = body.length + self.content_length = body.bytesize delete 'Transfer-Encoding' supply_default_content_type write_header(sock, ver, path) unless send_only == :body