actionmailer 2.3.18 → 3.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionmailer might be problematic. Click here for more details.

Files changed (154) hide show
  1. data/CHANGELOG +13 -16
  2. data/README +39 -21
  3. data/lib/action_mailer/adv_attr_accessor.rb +14 -18
  4. data/lib/action_mailer/base.rb +437 -560
  5. data/lib/action_mailer/collector.rb +36 -0
  6. data/lib/action_mailer/delivery_methods.rb +86 -0
  7. data/lib/action_mailer/deprecated_api.rb +139 -0
  8. data/lib/action_mailer/mail_helper.rb +25 -13
  9. data/lib/action_mailer/old_api.rb +248 -0
  10. data/lib/action_mailer/quoting.rb +4 -2
  11. data/lib/action_mailer/railtie.rb +25 -0
  12. data/lib/action_mailer/railties/subscriber.rb +20 -0
  13. data/lib/action_mailer/test_case.rb +4 -6
  14. data/lib/action_mailer/test_helper.rb +0 -1
  15. data/lib/action_mailer/tmail_compat.rb +34 -0
  16. data/lib/action_mailer/version.rb +3 -3
  17. data/lib/action_mailer.rb +25 -30
  18. metadata +41 -161
  19. data/Rakefile +0 -97
  20. data/install.rb +0 -30
  21. data/lib/action_mailer/helpers.rb +0 -113
  22. data/lib/action_mailer/part.rb +0 -107
  23. data/lib/action_mailer/part_container.rb +0 -55
  24. data/lib/action_mailer/utils.rb +0 -7
  25. data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +0 -1466
  26. data/lib/action_mailer/vendor/text_format.rb +0 -10
  27. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +0 -18
  28. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb +0 -392
  29. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +0 -65
  30. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb +0 -46
  31. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb +0 -41
  32. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb +0 -67
  33. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb +0 -63
  34. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb +0 -590
  35. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb +0 -962
  36. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb +0 -9
  37. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb +0 -1162
  38. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb +0 -3
  39. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb +0 -578
  40. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb +0 -496
  41. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb +0 -6
  42. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb +0 -3
  43. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb +0 -250
  44. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb +0 -132
  45. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +0 -1060
  46. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +0 -416
  47. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb +0 -379
  48. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb +0 -164
  49. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/require_arch.rb +0 -58
  50. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb +0 -49
  51. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb +0 -262
  52. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/stringio.rb +0 -280
  53. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb +0 -362
  54. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +0 -504
  55. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +0 -12
  56. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +0 -927
  57. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +0 -42
  58. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +0 -238
  59. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +0 -112
  60. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +0 -75
  61. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +0 -64
  62. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +0 -42
  63. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +0 -89
  64. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +0 -244
  65. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +0 -88
  66. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +0 -596
  67. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +0 -42
  68. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +0 -430
  69. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +0 -42
  70. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +0 -474
  71. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +0 -42
  72. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +0 -289
  73. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +0 -570
  74. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +0 -229
  75. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +0 -229
  76. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +0 -330
  77. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +0 -227
  78. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +0 -202
  79. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +0 -226
  80. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +0 -201
  81. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +0 -147
  82. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +0 -89
  83. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +0 -45
  84. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +0 -542
  85. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +0 -124
  86. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +0 -56
  87. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +0 -88
  88. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +0 -168
  89. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +0 -87
  90. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +0 -67
  91. data/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb +0 -39
  92. data/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb +0 -6
  93. data/lib/action_mailer/vendor/tmail.rb +0 -17
  94. data/lib/actionmailer.rb +0 -2
  95. data/test/abstract_unit.rb +0 -62
  96. data/test/asset_host_test.rb +0 -54
  97. data/test/delivery_method_test.rb +0 -51
  98. data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +0 -1
  99. data/test/fixtures/auto_layout_mailer/hello.html.erb +0 -1
  100. data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +0 -1
  101. data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +0 -1
  102. data/test/fixtures/explicit_layout_mailer/logout.html.erb +0 -1
  103. data/test/fixtures/explicit_layout_mailer/signup.html.erb +0 -1
  104. data/test/fixtures/first_mailer/share.erb +0 -1
  105. data/test/fixtures/helper_mailer/use_example_helper.erb +0 -1
  106. data/test/fixtures/helper_mailer/use_helper.erb +0 -1
  107. data/test/fixtures/helper_mailer/use_helper_method.erb +0 -1
  108. data/test/fixtures/helper_mailer/use_mail_helper.erb +0 -5
  109. data/test/fixtures/helpers/example_helper.rb +0 -5
  110. data/test/fixtures/layouts/auto_layout_mailer.html.erb +0 -1
  111. data/test/fixtures/layouts/auto_layout_mailer.text.erb +0 -1
  112. data/test/fixtures/layouts/spam.html.erb +0 -1
  113. data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +0 -1
  114. data/test/fixtures/raw_email +0 -14
  115. data/test/fixtures/raw_email10 +0 -20
  116. data/test/fixtures/raw_email12 +0 -32
  117. data/test/fixtures/raw_email13 +0 -29
  118. data/test/fixtures/raw_email2 +0 -114
  119. data/test/fixtures/raw_email3 +0 -70
  120. data/test/fixtures/raw_email4 +0 -59
  121. data/test/fixtures/raw_email5 +0 -19
  122. data/test/fixtures/raw_email6 +0 -20
  123. data/test/fixtures/raw_email7 +0 -66
  124. data/test/fixtures/raw_email8 +0 -47
  125. data/test/fixtures/raw_email9 +0 -28
  126. data/test/fixtures/raw_email_quoted_with_0d0a +0 -14
  127. data/test/fixtures/raw_email_with_invalid_characters_in_content_type +0 -104
  128. data/test/fixtures/raw_email_with_nested_attachment +0 -100
  129. data/test/fixtures/raw_email_with_partially_quoted_subject +0 -14
  130. data/test/fixtures/second_mailer/share.erb +0 -1
  131. data/test/fixtures/templates/signed_up.erb +0 -3
  132. data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +0 -1
  133. data/test/fixtures/test_mailer/body_ivar.erb +0 -2
  134. data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +0 -6
  135. data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +0 -6
  136. data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +0 -1
  137. data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +0 -1
  138. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +0 -10
  139. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +0 -10
  140. data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +0 -2
  141. data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +0 -1
  142. data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +0 -1
  143. data/test/fixtures/test_mailer/rxml_template.builder +0 -2
  144. data/test/fixtures/test_mailer/rxml_template.rxml +0 -2
  145. data/test/fixtures/test_mailer/signed_up.html.erb +0 -3
  146. data/test/fixtures/test_mailer/signed_up_with_url.erb +0 -5
  147. data/test/mail_helper_test.rb +0 -95
  148. data/test/mail_layout_test.rb +0 -123
  149. data/test/mail_render_test.rb +0 -116
  150. data/test/mail_service_test.rb +0 -1145
  151. data/test/quoting_test.rb +0 -105
  152. data/test/test_helper_test.rb +0 -129
  153. data/test/tmail_test.rb +0 -22
  154. data/test/url_test.rb +0 -76
@@ -1,244 +0,0 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # The Original Code is mozilla.org code.
3
- #
4
- # The Initial Developer of the Original Code is
5
- # Netscape Communications Corporation.
6
- # Portions created by the Initial Developer are Copyright (C) 1998
7
- # the Initial Developer. All Rights Reserved.
8
- #
9
- # Contributor(s):
10
- # Mark Pilgrim - port to Python
11
- #
12
- # This library is free software; you can redistribute it and/or
13
- # modify it under the terms of the GNU Lesser General Public
14
- # License as published by the Free Software Foundation; either
15
- # version 2.1 of the License, or (at your option) any later version.
16
- #
17
- # This library is distributed in the hope that it will be useful,
18
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20
- # Lesser General Public License for more details.
21
- #
22
- # You should have received a copy of the GNU Lesser General Public
23
- # License along with this library; if not, write to the Free Software
24
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25
- # 02110-1301 USA
26
- ######################### END LICENSE BLOCK #########################
27
-
28
- module CharDet
29
- HZ_cls = [
30
- 1,0,0,0,0,0,0,0, # 00 - 07
31
- 0,0,0,0,0,0,0,0, # 08 - 0f
32
- 0,0,0,0,0,0,0,0, # 10 - 17
33
- 0,0,0,1,0,0,0,0, # 18 - 1f
34
- 0,0,0,0,0,0,0,0, # 20 - 27
35
- 0,0,0,0,0,0,0,0, # 28 - 2f
36
- 0,0,0,0,0,0,0,0, # 30 - 37
37
- 0,0,0,0,0,0,0,0, # 38 - 3f
38
- 0,0,0,0,0,0,0,0, # 40 - 47
39
- 0,0,0,0,0,0,0,0, # 48 - 4f
40
- 0,0,0,0,0,0,0,0, # 50 - 57
41
- 0,0,0,0,0,0,0,0, # 58 - 5f
42
- 0,0,0,0,0,0,0,0, # 60 - 67
43
- 0,0,0,0,0,0,0,0, # 68 - 6f
44
- 0,0,0,0,0,0,0,0, # 70 - 77
45
- 0,0,0,4,0,5,2,0, # 78 - 7f
46
- 1,1,1,1,1,1,1,1, # 80 - 87
47
- 1,1,1,1,1,1,1,1, # 88 - 8f
48
- 1,1,1,1,1,1,1,1, # 90 - 97
49
- 1,1,1,1,1,1,1,1, # 98 - 9f
50
- 1,1,1,1,1,1,1,1, # a0 - a7
51
- 1,1,1,1,1,1,1,1, # a8 - af
52
- 1,1,1,1,1,1,1,1, # b0 - b7
53
- 1,1,1,1,1,1,1,1, # b8 - bf
54
- 1,1,1,1,1,1,1,1, # c0 - c7
55
- 1,1,1,1,1,1,1,1, # c8 - cf
56
- 1,1,1,1,1,1,1,1, # d0 - d7
57
- 1,1,1,1,1,1,1,1, # d8 - df
58
- 1,1,1,1,1,1,1,1, # e0 - e7
59
- 1,1,1,1,1,1,1,1, # e8 - ef
60
- 1,1,1,1,1,1,1,1, # f0 - f7
61
- 1,1,1,1,1,1,1,1, # f8 - ff
62
- ]
63
-
64
- HZ_st = [
65
- EStart,EError, 3,EStart,EStart,EStart,EError,EError,# 00-07
66
- EError,EError,EError,EError,EItsMe,EItsMe,EItsMe,EItsMe,# 08-0f
67
- EItsMe,EItsMe,EError,EError,EStart,EStart, 4,EError,# 10-17
68
- 5,EError, 6,EError, 5, 5, 4,EError,# 18-1f
69
- 4,EError, 4, 4, 4,EError, 4,EError,# 20-27
70
- 4,EItsMe,EStart,EStart,EStart,EStart,EStart,EStart,# 28-2f
71
- ]
72
-
73
- HZCharLenTable = [0, 0, 0, 0, 0, 0]
74
-
75
- HZSMModel = {'classTable' => HZ_cls,
76
- 'classFactor' => 6,
77
- 'stateTable' => HZ_st,
78
- 'charLenTable' => HZCharLenTable,
79
- 'name' => "HZ-GB-2312"
80
- }
81
-
82
- ISO2022CN_cls = [
83
- 2,0,0,0,0,0,0,0, # 00 - 07
84
- 0,0,0,0,0,0,0,0, # 08 - 0f
85
- 0,0,0,0,0,0,0,0, # 10 - 17
86
- 0,0,0,1,0,0,0,0, # 18 - 1f
87
- 0,0,0,0,0,0,0,0, # 20 - 27
88
- 0,3,0,0,0,0,0,0, # 28 - 2f
89
- 0,0,0,0,0,0,0,0, # 30 - 37
90
- 0,0,0,0,0,0,0,0, # 38 - 3f
91
- 0,0,0,4,0,0,0,0, # 40 - 47
92
- 0,0,0,0,0,0,0,0, # 48 - 4f
93
- 0,0,0,0,0,0,0,0, # 50 - 57
94
- 0,0,0,0,0,0,0,0, # 58 - 5f
95
- 0,0,0,0,0,0,0,0, # 60 - 67
96
- 0,0,0,0,0,0,0,0, # 68 - 6f
97
- 0,0,0,0,0,0,0,0, # 70 - 77
98
- 0,0,0,0,0,0,0,0, # 78 - 7f
99
- 2,2,2,2,2,2,2,2, # 80 - 87
100
- 2,2,2,2,2,2,2,2, # 88 - 8f
101
- 2,2,2,2,2,2,2,2, # 90 - 97
102
- 2,2,2,2,2,2,2,2, # 98 - 9f
103
- 2,2,2,2,2,2,2,2, # a0 - a7
104
- 2,2,2,2,2,2,2,2, # a8 - af
105
- 2,2,2,2,2,2,2,2, # b0 - b7
106
- 2,2,2,2,2,2,2,2, # b8 - bf
107
- 2,2,2,2,2,2,2,2, # c0 - c7
108
- 2,2,2,2,2,2,2,2, # c8 - cf
109
- 2,2,2,2,2,2,2,2, # d0 - d7
110
- 2,2,2,2,2,2,2,2, # d8 - df
111
- 2,2,2,2,2,2,2,2, # e0 - e7
112
- 2,2,2,2,2,2,2,2, # e8 - ef
113
- 2,2,2,2,2,2,2,2, # f0 - f7
114
- 2,2,2,2,2,2,2,2, # f8 - ff
115
- ]
116
-
117
- ISO2022CN_st = [
118
- EStart, 3,EError,EStart,EStart,EStart,EStart,EStart,# 00-07
119
- EStart,EError,EError,EError,EError,EError,EError,EError,# 08-0f
120
- EError,EError,EItsMe,EItsMe,EItsMe,EItsMe,EItsMe,EItsMe,# 10-17
121
- EItsMe,EItsMe,EItsMe,EError,EError,EError, 4,EError,# 18-1f
122
- EError,EError,EError,EItsMe,EError,EError,EError,EError,# 20-27
123
- 5, 6,EError,EError,EError,EError,EError,EError,# 28-2f
124
- EError,EError,EError,EItsMe,EError,EError,EError,EError,# 30-37
125
- EError,EError,EError,EError,EError,EItsMe,EError,EStart,# 38-3f
126
- ]
127
-
128
- ISO2022CNCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0]
129
-
130
- ISO2022CNSMModel = {'classTable' => ISO2022CN_cls,
131
- 'classFactor' => 9,
132
- 'stateTable' => ISO2022CN_st,
133
- 'charLenTable' => ISO2022CNCharLenTable,
134
- 'name' => "ISO-2022-CN"
135
- }
136
-
137
- ISO2022JP_cls = [
138
- 2,0,0,0,0,0,0,0, # 00 - 07
139
- 0,0,0,0,0,0,2,2, # 08 - 0f
140
- 0,0,0,0,0,0,0,0, # 10 - 17
141
- 0,0,0,1,0,0,0,0, # 18 - 1f
142
- 0,0,0,0,7,0,0,0, # 20 - 27
143
- 3,0,0,0,0,0,0,0, # 28 - 2f
144
- 0,0,0,0,0,0,0,0, # 30 - 37
145
- 0,0,0,0,0,0,0,0, # 38 - 3f
146
- 6,0,4,0,8,0,0,0, # 40 - 47
147
- 0,9,5,0,0,0,0,0, # 48 - 4f
148
- 0,0,0,0,0,0,0,0, # 50 - 57
149
- 0,0,0,0,0,0,0,0, # 58 - 5f
150
- 0,0,0,0,0,0,0,0, # 60 - 67
151
- 0,0,0,0,0,0,0,0, # 68 - 6f
152
- 0,0,0,0,0,0,0,0, # 70 - 77
153
- 0,0,0,0,0,0,0,0, # 78 - 7f
154
- 2,2,2,2,2,2,2,2, # 80 - 87
155
- 2,2,2,2,2,2,2,2, # 88 - 8f
156
- 2,2,2,2,2,2,2,2, # 90 - 97
157
- 2,2,2,2,2,2,2,2, # 98 - 9f
158
- 2,2,2,2,2,2,2,2, # a0 - a7
159
- 2,2,2,2,2,2,2,2, # a8 - af
160
- 2,2,2,2,2,2,2,2, # b0 - b7
161
- 2,2,2,2,2,2,2,2, # b8 - bf
162
- 2,2,2,2,2,2,2,2, # c0 - c7
163
- 2,2,2,2,2,2,2,2, # c8 - cf
164
- 2,2,2,2,2,2,2,2, # d0 - d7
165
- 2,2,2,2,2,2,2,2, # d8 - df
166
- 2,2,2,2,2,2,2,2, # e0 - e7
167
- 2,2,2,2,2,2,2,2, # e8 - ef
168
- 2,2,2,2,2,2,2,2, # f0 - f7
169
- 2,2,2,2,2,2,2,2, # f8 - ff
170
- ]
171
-
172
- ISO2022JP_st = [
173
- EStart, 3,EError,EStart,EStart,EStart,EStart,EStart,# 00-07
174
- EStart,EStart,EError,EError,EError,EError,EError,EError,# 08-0f
175
- EError,EError,EError,EError,EItsMe,EItsMe,EItsMe,EItsMe,# 10-17
176
- EItsMe,EItsMe,EItsMe,EItsMe,EItsMe,EItsMe,EError,EError,# 18-1f
177
- EError, 5,EError,EError,EError, 4,EError,EError,# 20-27
178
- EError,EError,EError, 6,EItsMe,EError,EItsMe,EError,# 28-2f
179
- EError,EError,EError,EError,EError,EError,EItsMe,EItsMe,# 30-37
180
- EError,EError,EError,EItsMe,EError,EError,EError,EError,# 38-3f
181
- EError,EError,EError,EError,EItsMe,EError,EStart,EStart,# 40-47
182
- ]
183
-
184
- ISO2022JPCharLenTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
185
-
186
- ISO2022JPSMModel = {'classTable' => ISO2022JP_cls,
187
- 'classFactor' => 10,
188
- 'stateTable' => ISO2022JP_st,
189
- 'charLenTable' => ISO2022JPCharLenTable,
190
- 'name' => "ISO-2022-JP"
191
- }
192
-
193
- ISO2022KR_cls = [
194
- 2,0,0,0,0,0,0,0, # 00 - 07
195
- 0,0,0,0,0,0,0,0, # 08 - 0f
196
- 0,0,0,0,0,0,0,0, # 10 - 17
197
- 0,0,0,1,0,0,0,0, # 18 - 1f
198
- 0,0,0,0,3,0,0,0, # 20 - 27
199
- 0,4,0,0,0,0,0,0, # 28 - 2f
200
- 0,0,0,0,0,0,0,0, # 30 - 37
201
- 0,0,0,0,0,0,0,0, # 38 - 3f
202
- 0,0,0,5,0,0,0,0, # 40 - 47
203
- 0,0,0,0,0,0,0,0, # 48 - 4f
204
- 0,0,0,0,0,0,0,0, # 50 - 57
205
- 0,0,0,0,0,0,0,0, # 58 - 5f
206
- 0,0,0,0,0,0,0,0, # 60 - 67
207
- 0,0,0,0,0,0,0,0, # 68 - 6f
208
- 0,0,0,0,0,0,0,0, # 70 - 77
209
- 0,0,0,0,0,0,0,0, # 78 - 7f
210
- 2,2,2,2,2,2,2,2, # 80 - 87
211
- 2,2,2,2,2,2,2,2, # 88 - 8f
212
- 2,2,2,2,2,2,2,2, # 90 - 97
213
- 2,2,2,2,2,2,2,2, # 98 - 9f
214
- 2,2,2,2,2,2,2,2, # a0 - a7
215
- 2,2,2,2,2,2,2,2, # a8 - af
216
- 2,2,2,2,2,2,2,2, # b0 - b7
217
- 2,2,2,2,2,2,2,2, # b8 - bf
218
- 2,2,2,2,2,2,2,2, # c0 - c7
219
- 2,2,2,2,2,2,2,2, # c8 - cf
220
- 2,2,2,2,2,2,2,2, # d0 - d7
221
- 2,2,2,2,2,2,2,2, # d8 - df
222
- 2,2,2,2,2,2,2,2, # e0 - e7
223
- 2,2,2,2,2,2,2,2, # e8 - ef
224
- 2,2,2,2,2,2,2,2, # f0 - f7
225
- 2,2,2,2,2,2,2,2, # f8 - ff
226
- ]
227
-
228
- ISO2022KR_st = [
229
- EStart, 3,EError,EStart,EStart,EStart,EError,EError,# 00-07
230
- EError,EError,EError,EError,EItsMe,EItsMe,EItsMe,EItsMe,# 08-0f
231
- EItsMe,EItsMe,EError,EError,EError, 4,EError,EError,# 10-17
232
- EError,EError,EError,EError, 5,EError,EError,EError,# 18-1f
233
- EError,EError,EError,EItsMe,EStart,EStart,EStart,EStart,# 20-27
234
- ]
235
-
236
- ISO2022KRCharLenTable = [0, 0, 0, 0, 0, 0]
237
-
238
- ISO2022KRSMModel = {'classTable' => ISO2022KR_cls,
239
- 'classFactor' => 6,
240
- 'stateTable' => ISO2022KR_st,
241
- 'charLenTable' => ISO2022KRCharLenTable,
242
- 'name' => "ISO-2022-KR"
243
- }
244
- end
@@ -1,88 +0,0 @@
1
- ######################## BEGIN LICENSE BLOCK ########################
2
- # The Original Code is mozilla.org code.
3
- #
4
- # The Initial Developer of the Original Code is
5
- # Netscape Communications Corporation.
6
- # Portions created by the Initial Developer are Copyright (C) 1998
7
- # the Initial Developer. All Rights Reserved.
8
- #
9
- # Contributor(s):
10
- # Jeff Hodges - port to Ruby
11
- # Mark Pilgrim - port to Python
12
- #
13
- # This library is free software; you can redistribute it and/or
14
- # modify it under the terms of the GNU Lesser General Public
15
- # License as published by the Free Software Foundation; either
16
- # version 2.1 of the License, or (at your option) any later version.
17
- #
18
- # This library is distributed in the hope that it will be useful,
19
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
- # Lesser General Public License for more details.
22
- #
23
- # You should have received a copy of the GNU Lesser General Public
24
- # License along with this library; if not, write to the Free Software
25
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
26
- # 02110-1301 USA
27
- ######################### END LICENSE BLOCK #########################
28
-
29
- module CharDet
30
- class EUCJPProber < MultiByteCharSetProber
31
- def initialize
32
- super()
33
- @_mCodingSM = CodingStateMachine.new(EUCJPSMModel)
34
- @_mDistributionAnalyzer = EUCJPDistributionAnalysis.new()
35
- @_mContextAnalyzer = EUCJPContextAnalysis.new()
36
- reset
37
- end
38
-
39
- def reset
40
- super()
41
- @_mContextAnalyzer.reset()
42
- end
43
-
44
- def get_charset_name
45
- return "EUC-JP"
46
- end
47
-
48
- def feed(aBuf)
49
- aLen = aBuf.length
50
- for i in (0...aLen)
51
- codingState = @_mCodingSM.next_state(aBuf[i..i])
52
- if codingState == EError
53
- $stderr << "#{get_charset_name} prober hit error at byte #{i}\n" if $debug
54
- @_mState = ENotMe
55
- break
56
- elsif codingState == EItsMe
57
- @_mState = EFoundIt
58
- break
59
- elsif codingState == EStart
60
- charLen = @_mCodingSM.get_current_charlen()
61
- if i == 0
62
- @_mLastChar[1] = aBuf[0..0]
63
- @_mContextAnalyzer.feed(@_mLastChar, charLen)
64
- @_mDistributionAnalyzer.feed(@_mLastChar, charLen)
65
- else
66
- @_mContextAnalyzer.feed(aBuf[i-1...i+1], charLen)
67
- @_mDistributionAnalyzer.feed(aBuf[i-1...i+1], charLen)
68
- end
69
- end
70
- end
71
-
72
- @_mLastChar[0] = aBuf[aLen-1..aLen-1]
73
-
74
- if get_state() == EDetecting
75
- if @_mContextAnalyzer.got_enough_data() and (get_confidence() > SHORTCUT_THRESHOLD)
76
- @_mState = EFoundIt
77
- end
78
- end
79
-
80
- return get_state()
81
- end
82
-
83
- def get_confidence
84
- l = [@_mContextAnalyzer.get_confidence,@_mDistributionAnalyzer.get_confidence]
85
- return l.max
86
- end
87
- end
88
- end