diff options
Diffstat (limited to 'lib/net/imap.rb')
-rw-r--r-- | lib/net/imap.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 540e366729..2398a5d10c 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -852,19 +852,19 @@ module Net end base64.unpack("m")[0].unpack("n*").pack("U*") end - } + }.force_encoding("UTF-8") end # Encode a string from UTF-8 format to modified UTF-7. def self.encode_utf7(s) - return s.gsub(/(&)|([^\x20-\x25\x27-\x7e]+)/n) { |x| + return s.gsub(/(&)|([^\x20-\x25\x27-\x7e]+)/u) { |x| if $1 "&-" else base64 = [x.unpack("U*").pack("n*")].pack("m") "&" + base64.delete("=\n").tr("/", ",") + "-" end - } + }.force_encoding("ASCII-8BIT") end private |