Skip to content

Commit

Permalink
use bytesize for binary strings. (merged from CRuby 1.9.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Aug 17, 2011
1 parent 83ea6c5 commit ece686b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/net/imap.rb
Expand Up @@ -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)
Expand Down Expand Up @@ -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, "\\\\\\&") + '"'
Expand Down

0 comments on commit ece686b

Please sign in to comment.