* lib/net/imap (encode_utf7): encode & properly. Thanks, Kengo
Matsuyama. [ruby-dev:38063] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ddafeb2f2a
commit
2587316c73
@ -1,3 +1,8 @@
|
|||||||
|
Wed Apr 14 12:56:21 2010 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/net/imap (encode_utf7): encode & properly. Thanks, Kengo
|
||||||
|
Matsuyama. [ruby-dev:38063]
|
||||||
|
|
||||||
Wed Apr 14 11:39:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Apr 14 11:39:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/syck/lib/syck/basenode.rb (Syck::BaseNode#match_path): fixed
|
* ext/syck/lib/syck/basenode.rb (Syck::BaseNode#match_path): fixed
|
||||||
|
@ -911,7 +911,7 @@ module Net
|
|||||||
|
|
||||||
# Encode a string from UTF-8 format to modified UTF-7.
|
# Encode a string from UTF-8 format to modified UTF-7.
|
||||||
def self.encode_utf7(s)
|
def self.encode_utf7(s)
|
||||||
return s.gsub(/(&)|([^\x20-\x25\x27-\x7e]+)/u) {
|
return s.gsub(/(&)|([^\x20-\x7e]+)/u) {
|
||||||
if $1
|
if $1
|
||||||
"&-"
|
"&-"
|
||||||
else
|
else
|
||||||
|
@ -19,6 +19,10 @@ class IMAPTest < Test::Unit::TestCase
|
|||||||
utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8")
|
utf8 = "\357\274\241\357\274\242\357\274\243".force_encoding("UTF-8")
|
||||||
s = Net::IMAP.encode_utf7(utf8)
|
s = Net::IMAP.encode_utf7(utf8)
|
||||||
assert_equal("&,yH,Iv8j-".force_encoding("UTF-8"), s)
|
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
|
end
|
||||||
|
|
||||||
def test_decode_utf7
|
def test_decode_utf7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user