Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merge revision(s) 27487:

	* lib/net/imap (encode_utf7): encode & properly.  Thanks, Kengo
	  Matsuyama.  [ruby-dev:38063]  backported from trunk.


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@28214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 8c6132023378ebffdd6c85100c5a43eb3b33db79 1 parent 9e784bc
@shyouhei shyouhei authored
View
5 ChangeLog
@@ -1,3 +1,8 @@
+Tue Jun 8 15:45:52 2010 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap (encode_utf7): encode & properly. Thanks, Kengo
+ Matsuyama. [ruby-dev:38063] backported from trunk.
+
Tue Jun 8 15:43:43 2010 Masaki Suketa <masaki.suketa@nifty.ne.jp>
* ext/win32ole/win32ole.c (ole_val2variant): fix the core dump
View
2  lib/net/imap.rb
@@ -841,7 +841,7 @@ def self.decode_utf7(s)
# 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-\x7e]+)/u) { |x|
if $1
"&-"
else
View
16 test/net/imap/test_imap.rb
@@ -8,4 +8,20 @@ def test_parse_nomodesq
assert_equal("OK", r.name)
assert_equal("NOMODSEQ", r.data.code.name)
end
+
+ def test_encode_utf7
+ utf8 = "\357\274\241\357\274\242\357\274\243"
+ s = Net::IMAP.encode_utf7(utf8)
+ assert_equal("&,yH,Iv8j-", s)
+
+ utf8 = "\343\201\202&"
+ s = Net::IMAP.encode_utf7(utf8)
+ assert_equal("&MEI-&-", s)
+ end
+
+ def test_decode_utf7
+ s = Net::IMAP.decode_utf7("&,yH,Iv8j-")
+ utf8 = "\357\274\241\357\274\242\357\274\243"
+ assert_equal(utf8, s)
+ end
end
View
2  version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2010-06-08"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20100608
-#define RUBY_PATCHLEVEL 278
+#define RUBY_PATCHLEVEL 279
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
Please sign in to comment.
Something went wrong with that request. Please try again.