[Bug #1191] Net::IMAP.encode_utf7 bug?


#1

Bug #1191: Net::IMAP.encode_utf7 bug?
http://redmine.ruby-lang.org/issues/show/1191

e$B5/I<<Te(B: Kengo Matsuyama
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Normal
ruby -v: ruby 1.9.2dev (2009-02-22 trunk 22492) [i686-linux]

Net::IMAP.encode_utf7 e$B$K$h$ke(B modified UTF-7
e$B$X$NJQ49$,@5$7$/$J$$$H;W$$$^$9!#e(B

Net::IMAP.encode_utf7(‘e$B$"e(B&’)
=> “&MEIAJg-”

e$B$HJQ49$5$l$^$9$,!"e(BRFC 3501 section 5.1.3 e$B$K=>$&$J$ie(B
“&MEI-&-” e$B$Ke(B
e$BJQ49$5$l$k$N$,@5$7$$$N$G$O$J$$$G$7$g$&$+!#e(B

modified UTF-7 e$B$NB>$N<BAu$,$"$^$j8+IU$+$i$J$+$C$?$N$G$9$,!"e(B
e$B$?$H$($Pe(B PHP e$B$G$Oe(B mb_convert_encoding("e$B$“e(B&”,
“utf7-imap”, “utf8”) e$B$Oe(B
“&MEI-&-” e$B$K$J$j$^$7$?!#e(B(Perl e$B$Ne(B Net::IMAPe$B!"e(BPython
e$B$Ne(B imaplib e$B$G$OL$<BAue(B?)

e$B0J2<$N%Q%C%A$G=$@5$G$-$^$9!#e(B

Index: lib/net/imap.rb

— lib/net/imap.rb (revision 22492)
+++ lib/net/imap.rb (working copy)
@@ -863,7 +863,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

#2

e$B%A%1%C%He(B #1191 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$BC4Ev<Te(B Shugo M.e$B$K%;%C%He(B

e$BA0ED$5$s!"e(B

e$B$3$N%A%1%C%H!"$I$&$G$9$+!)e(B


Yusuke E. removed_email_address@domain.invalid

http://redmine.ruby-lang.org/issues/show/1191


#3

e$B%A%1%C%He(B #1191 e$B$,99?7$5$l$^$7$?!#e(B (by Shugo M.)

e$B$4;XE&$NDL$j$J$N$G=$@5$7$F$*$-$^$9!#e(B

http://redmine.ruby-lang.org/issues/show/1191


#4

e$B%A%1%C%He(B #1191 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

e$B1sF#$G$9!#e(B

r27336 e$B$G=$@5$5$l$?$h$&$G$9!#e(B
e$B$"$j$,$H$&$4$6$$$^$7$?!#e(B


Yusuke E. removed_email_address@domain.invalid

http://redmine.ruby-lang.org/issues/show/1191