diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/net/imap.rb | 4 |
2 files changed, 7 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Fri Jan 14 14:56:57 2011 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/net/imap.rb: use bytesize for binary strings. + patched by Yoshimasa Niwa. [ruby-core:34222] + Fri Jan 14 14:01:12 2011 NARUSE, Yui <naruse@ruby-lang.org> * pack.c (pack_unpack): the resulted string of unpack('M') must have diff --git a/lib/net/imap.rb b/lib/net/imap.rb index dd0d6b42b7..0b76a9ff4a 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -1269,7 +1269,7 @@ module Net 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) @@ -2603,7 +2603,7 @@ module Net 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, "\\\\\\&") + '"' |