From ece686b8ce291b7d98e123c938f897dc2587a60d Mon Sep 17 00:00:00 2001 From: Watson Date: Wed, 17 Aug 2011 10:36:01 +0900 Subject: [PATCH] use bytesize for binary strings. (merged from CRuby 1.9.2) https://github.com/ruby/ruby/commit/8de1ee21e45c66b51e0dbd3d49aa50e5f42ea2c3 --- lib/net/imap.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 340470029..f28c99e67 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -1237,7 +1237,7 @@ def send_quoted_string(str) end def send_literal(str) - put_string("{" + str.length.to_s + "}" + CRLF) + put_string("{" + str.bytesize.to_s + "}" + CRLF) @continuation_request_arrival.wait raise @exception if @exception put_string(str) @@ -2571,7 +2571,7 @@ def format_string(str) return '""' when /[\x80-\xff\r\n]/n # literal - return "{" + str.length.to_s + "}" + CRLF + str + return "{" + str.bytesize.to_s + "}" + CRLF + str when /[(){ \x00-\x1f\x7f%*"\\]/n # quoted string return '"' + str.gsub(/["\\]/n, "\\\\\\&") + '"'