ruby-changes:15438
From: shugo <ko1@a...>
Date: Wed, 14 Apr 2010 13:00:25 +0900 (JST)
Subject: [ruby-changes:15438] Ruby:r27336 (trunk): * lib/net/imap (encode_utf7): encode & properly. Thanks, Kengo
shugo 2010-04-14 13:00:09 +0900 (Wed, 14 Apr 2010) New Revision: 27336 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27336 Log: * lib/net/imap (encode_utf7): encode & properly. Thanks, Kengo Matsuyama. [ruby-dev:38063] Modified files: trunk/ChangeLog trunk/lib/net/imap.rb trunk/test/net/imap/test_imap.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27335) +++ ChangeLog (revision 27336) @@ -1,3 +1,8 @@ +Wed Apr 14 12:56:21 2010 Shugo Maeda <shugo@r...> + + * lib/net/imap (encode_utf7): encode & properly. Thanks, Kengo + Matsuyama. [ruby-dev:38063] + Wed Apr 14 11:39:26 2010 Nobuyoshi Nakada <nobu@r...> * ext/syck/lib/syck/basenode.rb (Syck::BaseNode#match_path): fixed Index: lib/net/imap.rb =================================================================== --- lib/net/imap.rb (revision 27335) +++ lib/net/imap.rb (revision 27336) @@ -911,7 +911,7 @@ # Encode a string from UTF-8 format to modified UTF-7. def self.encode_utf7(s) - return s.gsub(/(&)|([^\x20-\x25\x27-\x7e]+)/u) { + return s.gsub(/(&)|([^\x20-\x7e]+)/u) { if $1 "&-" else Index: test/net/imap/test_imap.rb =================================================================== --- test/net/imap/test_imap.rb (revision 27335) +++ test/net/imap/test_imap.rb (revision 27336) @@ -19,6 +19,10 @@ utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8") s = Net::IMAP.encode_utf7(utf8) assert_equal("&,yH,Iv8j-".force_encoding("UTF-8"), s) + + utf8 = "\343\201\202&".force_encoding("UTF-8") + s = Net::IMAP.encode_utf7(utf8) + assert_equal("&MEI-&-".force_encoding("UTF-8"), s) end def test_decode_utf7 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/