mail-iso-2022-jp 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/lib/mail-iso-2022-jp/patches.rb +16 -1
- metadata +25 -49
data/README.md
CHANGED
@@ -107,10 +107,10 @@ Remarks
|
|
107
107
|
-------
|
108
108
|
|
109
109
|
* Wave dashes (U+301C) are replaced with fullwidth tildes (U+FF5E) before converted to iso-2022-jp.
|
110
|
-
* Special characters such as `髙` or `﨑`
|
110
|
+
* Special characters such as `髙` or `﨑` are handled correctly.
|
111
111
|
|
112
112
|
* 波ダッシュ(U+301C)は、iso-2022-jpへの変換前に全角チルダ(U+FF5E)で置き換えられます。
|
113
|
-
* `髙` や `﨑`
|
113
|
+
* `髙` や `﨑` 等のIBM拡張文字も扱えます。
|
114
114
|
|
115
115
|
|
116
116
|
References
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# coding:utf-8
|
2
2
|
|
3
|
+
require 'base64'
|
4
|
+
|
3
5
|
module Mail
|
4
6
|
WAVE_DASH = "〜" # U+301C
|
5
7
|
FULLWIDTH_TILDE = "~" # U+FF5E
|
@@ -38,7 +40,10 @@ module Mail
|
|
38
40
|
def initialize_with_iso_2022_jp_encoding(value = nil, charset = 'utf-8')
|
39
41
|
if charset.to_s.downcase == 'iso-2022-jp'
|
40
42
|
value.gsub!(/#{WAVE_DASH}/, FULLWIDTH_TILDE)
|
41
|
-
value = NKF.nkf('--cp932 -
|
43
|
+
value = NKF.nkf('--cp932 -j', value)
|
44
|
+
value.force_encoding('ascii-8bit') if RUBY_VERSION >= '1.9'
|
45
|
+
value = b_value_encode(value)
|
46
|
+
value.force_encoding('ascii-8bit') if RUBY_VERSION >= '1.9'
|
42
47
|
end
|
43
48
|
initialize_without_iso_2022_jp_encoding(value, charset)
|
44
49
|
end
|
@@ -51,6 +56,16 @@ module Mail
|
|
51
56
|
do_decode_without_iso_2022_jp_encoding
|
52
57
|
end
|
53
58
|
end
|
59
|
+
|
60
|
+
def b_value_encode(string)
|
61
|
+
string.split(' ').map do |s|
|
62
|
+
if s =~ /^\e/
|
63
|
+
"=?ISO-2022-JP?B?#{Base64.encode64(s).gsub("\n", "")}?="
|
64
|
+
else
|
65
|
+
s
|
66
|
+
end
|
67
|
+
end.join(" ")
|
68
|
+
end
|
54
69
|
end
|
55
70
|
|
56
71
|
class SubjectField < UnstructuredField
|
metadata
CHANGED
@@ -1,48 +1,34 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail-iso-2022-jp
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 1.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Kohei MATSUSHITA
|
14
9
|
- Tsutomu KURODA
|
15
10
|
autorequire:
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-11-20 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: mail
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &8477100 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 13
|
30
|
-
segments:
|
31
|
-
- 2
|
32
|
-
- 2
|
33
|
-
- 5
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
34
22
|
version: 2.2.5
|
35
23
|
type: :runtime
|
36
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *8477100
|
37
26
|
description: A patch that provides 'mail' gem with iso-2022-jp conversion capability.
|
38
27
|
email: hermes@oiax.jp
|
39
28
|
executables: []
|
40
|
-
|
41
29
|
extensions: []
|
42
|
-
|
43
30
|
extra_rdoc_files: []
|
44
|
-
|
45
|
-
files:
|
31
|
+
files:
|
46
32
|
- README.md
|
47
33
|
- Gemfile
|
48
34
|
- Rakefile
|
@@ -50,36 +36,26 @@ files:
|
|
50
36
|
- lib/mail-iso-2022-jp/patches.rb
|
51
37
|
homepage: http://github.com/kuroda/mail-iso-2022-jp
|
52
38
|
licenses: []
|
53
|
-
|
54
39
|
post_install_message:
|
55
40
|
rdoc_options: []
|
56
|
-
|
57
|
-
require_paths:
|
41
|
+
require_paths:
|
58
42
|
- lib
|
59
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
44
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
|
66
|
-
- 0
|
67
|
-
version: "0"
|
68
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
50
|
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
segments:
|
75
|
-
- 0
|
76
|
-
version: "0"
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
77
55
|
requirements: []
|
78
|
-
|
79
56
|
rubyforge_project:
|
80
57
|
rubygems_version: 1.8.10
|
81
58
|
signing_key:
|
82
59
|
specification_version: 3
|
83
60
|
summary: A patch that provides 'mail' gem with iso-2022-jp conversion capability.
|
84
61
|
test_files: []
|
85
|
-
|