mail-iso-2022-jp 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +13 -1
- data/lib/mail-iso-2022-jp/patches.rb +7 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -40,7 +40,7 @@ Requirements
|
|
40
40
|
|
41
41
|
### Ruby ###
|
42
42
|
|
43
|
-
* 1.8.7
|
43
|
+
* 1.8.7
|
44
44
|
|
45
45
|
### Gems ###
|
46
46
|
|
@@ -103,6 +103,18 @@ or run this command:
|
|
103
103
|
end
|
104
104
|
|
105
105
|
|
106
|
+
Remarks
|
107
|
+
-------
|
108
|
+
|
109
|
+
* Does not work with Ruby 1.9.x, currently.
|
110
|
+
* Wave dashes (U+301C) are replaced with fullwidth tildes (U+FF5E) before converted to iso-2022-jp.
|
111
|
+
* Special characters such as `髙` or `﨑` can't be handled correctly when they are found in the mail headers. This is a TODO.
|
112
|
+
|
113
|
+
* 現在のところ、Ruby 1.9.x では動作しません。
|
114
|
+
* 波ダッシュ(U+301C)は、iso-2022-jpへの変換前に全角チルダ(U+FF5E)で置き換えられます。
|
115
|
+
* `髙` や `﨑` といった特殊文字がメールヘッダにある場合は、正しく扱えません。これはTODO項目です。
|
116
|
+
|
117
|
+
|
106
118
|
License
|
107
119
|
-------
|
108
120
|
|
@@ -1,8 +1,13 @@
|
|
1
|
+
# coding:utf-8
|
1
2
|
module Mail
|
3
|
+
WAVE_DASH = "〜" # U+301C
|
4
|
+
FULLWIDTH_TILDE = "~" # U+FF5E
|
5
|
+
|
2
6
|
class Message
|
3
7
|
def process_body_raw_with_iso_2022_jp_encoding
|
4
8
|
if @charset.to_s.downcase == 'iso-2022-jp'
|
5
|
-
@body_raw
|
9
|
+
@body_raw.gsub!(/#{WAVE_DASH}/, FULLWIDTH_TILDE)
|
10
|
+
@body_raw = NKF.nkf('--cp932 -j', @body_raw)
|
6
11
|
end
|
7
12
|
process_body_raw_without_iso_2022_jp_encoding
|
8
13
|
end
|
@@ -20,6 +25,7 @@ module Mail
|
|
20
25
|
|
21
26
|
def initialize_with_iso_2022_jp_encoding(value = nil, charset = 'utf-8')
|
22
27
|
if charset.to_s.downcase == 'iso-2022-jp'
|
28
|
+
value.gsub!(/#{WAVE_DASH}/, FULLWIDTH_TILDE)
|
23
29
|
value = NKF.nkf('--cp932 -M', NKF.nkf('--cp932 -j', value)).gsub("\n", '').strip
|
24
30
|
end
|
25
31
|
initialize_without_iso_2022_jp_encoding(value, charset)
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail-iso-2022-jp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
|
-
- Kohei
|
13
|
+
- Kohei MATSUSHITA
|
14
14
|
- Tsutomu KURODA
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-11-
|
19
|
+
date: 2011-11-20 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: mail
|