jpmobile 1.0.12 → 2.0.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -3
- data/README.rdoc +2 -14
- data/Rakefile +0 -1
- data/VERSION.yml +4 -4
- data/jpmobile.gemspec +2 -1
- data/lib/jpmobile.rb +1 -15
- data/lib/jpmobile/docomo_guid.rb +1 -1
- data/lib/jpmobile/emoticon.rb +3 -119
- data/lib/jpmobile/emoticon/z_combine.rb +1 -17
- data/lib/jpmobile/filter.rb +1 -6
- data/lib/jpmobile/helpers.rb +1 -1
- data/lib/jpmobile/mail.rb +27 -196
- data/lib/jpmobile/mailer.rb +1 -7
- data/lib/jpmobile/mobile/abstract_mobile.rb +36 -94
- data/lib/jpmobile/mobile/android.rb +0 -2
- data/lib/jpmobile/mobile/au.rb +0 -4
- data/lib/jpmobile/mobile/docomo.rb +0 -8
- data/lib/jpmobile/mobile/iphone.rb +15 -1
- data/lib/jpmobile/mobile/smart_phone.rb +0 -10
- data/lib/jpmobile/mobile/softbank.rb +0 -8
- data/lib/jpmobile/rack.rb +1 -6
- data/lib/jpmobile/rack/filter.rb +1 -7
- data/lib/jpmobile/rack/params_filter.rb +2 -2
- data/lib/jpmobile/rails.rb +1 -1
- data/lib/jpmobile/resolver.rb +2 -5
- data/lib/jpmobile/trans_sid.rb +1 -26
- data/lib/jpmobile/util.rb +11 -82
- data/lib/tasks/jpmobile_tasks.rake +1 -1
- data/spec/rack/jpmobile/emoticon_spec.rb +0 -223
- data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -5
- data/spec/rack/jpmobile/softbank_spec.rb +1 -1
- data/spec/unit/emoticon_spec.rb +0 -64
- data/spec/unit/encoding_spec.rb +2 -2
- data/spec/unit/mail_spec.rb +2 -159
- data/spec/unit/receive_mail_spec.rb +5 -51
- data/spec/unit/spec_helper.rb +1 -1
- data/spec/unit/util_spec.rb +3 -62
- data/test/rails/overrides/Gemfile +1 -1
- data/test/rails/overrides/app/controllers/filter_controller_base.rb +0 -3
- data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +0 -3
- data/test/rails/overrides/app/controllers/template_path_controller.rb +0 -12
- data/test/rails/overrides/app/{mailers → models}/mobile_mailer.rb +1 -7
- data/test/rails/overrides/app/{mailers → models}/normal_mailer.rb +0 -0
- data/test/rails/overrides/spec/{mailers → models}/mobile_mailer_spec.rb +1 -18
- data/test/rails/overrides/spec/{mailers → models}/normal_mailer_spec.rb +0 -0
- data/test/rails/overrides/spec/requests/filter_spec.rb +0 -18
- data/test/rails/overrides/spec/requests/template_path_spec.rb +0 -72
- data/test/rails/overrides/spec/spec_helper.rb +1 -1
- data/test/sinatra/guestbook.rb +7 -8
- data/test/sinatra/test/filter_test.rb +0 -10
- metadata +169 -296
- data/lib/jpmobile/emoticon/google.rb +0 -2421
- data/lib/jpmobile/emoticon/unicode.rb +0 -2253
- data/lib/jpmobile/mobile/android_tablet.rb +0 -12
- data/lib/jpmobile/mobile/black_berry.rb +0 -10
- data/lib/jpmobile/mobile/google_emoticon.rb +0 -29
- data/lib/jpmobile/mobile/ipad.rb +0 -12
- data/lib/jpmobile/mobile/tablet.rb +0 -16
- data/lib/jpmobile/mobile/unicode_emoticon.rb +0 -43
- data/lib/jpmobile/sinatra.rb +0 -16
- data/spec/rack/jpmobile/black_berry_spec.rb +0 -20
- data/spec/unit/decorated_mail_spec.rb +0 -76
- data/spec/unit/email-fixtures/bounce_with_utf8_part.eml +0 -42
- data/spec/unit/email-fixtures/iphone-mail3.eml +0 -56
- data/spec/unit/email-fixtures/iphone-message.eml +0 -27
- data/spec/unit/email-fixtures/photo.jpg +0 -0
- data/spec/unit/mobile/iphone_spec.rb +0 -34
- data/test/rails/overrides/app/mailers/decorated_mailer.rb +0 -11
- data/test/rails/overrides/app/views/decorated_mailer/deco_mail.html.erb +0 -10
- data/test/rails/overrides/app/views/decorated_mailer/deco_mail.text.erb +0 -1
- data/test/rails/overrides/app/views/hankaku_input_filter/with_charset.html.erb +0 -1
- data/test/rails/overrides/app/views/layouts/with_charset.html.erb +0 -13
- data/test/rails/overrides/app/views/template_path/smart_phone_only.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/smart_phone_only_smart_phone.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_ipd.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_ipd_tablet_ipad.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_tblt.html.erb +0 -1
- data/test/rails/overrides/app/views/template_path/with_tblt_tablet.html.erb +0 -1
- data/test/rails/overrides/spec/fixtures/mobile_mailer/bounced-jp.eml +0 -72
- data/test/rails/overrides/spec/fixtures/mobile_mailer/photo.jpg +0 -0
- data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +0 -44
- data/test/sinatra/config.ru +0 -2
- data/test/sinatra/views/index.erb +0 -1
- data/test/sinatra/views/index_mobile.erb +0 -1
- data/tools/e4u_conv.rb +0 -122
data/spec/unit/encoding_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe "Jpmobile::Mobile" do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should convert emoticon  to \x75\x41 in B-Encoding" do
|
62
|
-
@mobile.to_mail_subject("ほげ").should == "=?ISO-2022-JP?B?
|
62
|
+
@mobile.to_mail_subject("ほげ").should == "=?ISO-2022-JP?B?GyRCJFskMhsoQhskQnVBGyhC?="
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
@@ -69,7 +69,7 @@ describe "Jpmobile::Mobile" do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should convert emoticon  to \x75\x41" do
|
72
|
-
ascii_8bit(@mobile.to_mail_body("ほげ")).should == ascii_8bit(jis("\
|
72
|
+
ascii_8bit(@mobile.to_mail_body("ほげ")).should == ascii_8bit(utf8_to_jis("ほげ") + jis("\x1b\x24\x42\x75\x41\x1b\x28\x42"))
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
data/spec/unit/mail_spec.rb
CHANGED
@@ -19,31 +19,6 @@ describe "Jpmobile::Mail" do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
describe "Non-mobile" do
|
23
|
-
before(:each) do
|
24
|
-
@mail = Mail.new do
|
25
|
-
subject "万葉"
|
26
|
-
from "ちはやふる <info@jpmobile-rails.org>"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
context "has multipart body" do
|
30
|
-
before(:each) do
|
31
|
-
@mail.parts << Mail::Part.new { body "ほげ" }
|
32
|
-
@mail.parts << Mail::Part.new { body "ほげほげ" }
|
33
|
-
@mail.parts.each{|p| p.charset = "ISO-2022-JP" }
|
34
|
-
end
|
35
|
-
context "to_s" do
|
36
|
-
subject {
|
37
|
-
Mail.new ascii_8bit(@mail.to_s)
|
38
|
-
}
|
39
|
-
it "should be able to decode bodies" do
|
40
|
-
subject.parts[0].body == "ほげ"
|
41
|
-
subject.parts[1].body == "ほげほげ"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
22
|
describe "AbstractMobile" do
|
48
23
|
before(:each) do
|
49
24
|
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
|
@@ -136,8 +111,8 @@ describe "Jpmobile::Mail" do
|
|
136
111
|
@mail.subject += ""
|
137
112
|
@mail.body = "#{@mail.body}"
|
138
113
|
|
139
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?
|
140
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\
|
114
|
+
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCS3xNVRsoQhskQnVBGyhC?=")))
|
115
|
+
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x75\x41\x1b\x28\x42"))))
|
141
116
|
end
|
142
117
|
end
|
143
118
|
end
|
@@ -254,136 +229,4 @@ describe "Jpmobile::Mail" do
|
|
254
229
|
end
|
255
230
|
end
|
256
231
|
end
|
257
|
-
|
258
|
-
describe "long subject with half-characters" do
|
259
|
-
before(:each) do
|
260
|
-
@mail = Mail.new
|
261
|
-
@mail.subject = "西暦2012年09月03日は今日になるわけだが10時16分現在のこの時間ではどうかな"
|
262
|
-
@mail.body = "株式会社・・"
|
263
|
-
@mail.from = "info@jpmobile-rails.org"
|
264
|
-
end
|
265
|
-
|
266
|
-
describe "AbstractMobile" do
|
267
|
-
before(:each) do
|
268
|
-
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
|
269
|
-
@mail.mobile = @mobile
|
270
|
-
@mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
|
271
|
-
end
|
272
|
-
|
273
|
-
context "to_s" do
|
274
|
-
it "should contain encoded subject" do
|
275
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCQD5OcRsoQjIwMTIbJEJHLxsoQjA5GyRCN24bKEIwMxskQkZ8JE86IxsoQg==?=")))
|
276
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCRnwkSyRKJGskbyQxJEAkLBsoQjEwGyRCO34bKEIxNhskQkosOD0bKEI=?=")))
|
277
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape("=?ISO-2022-JP?B?GyRCOl8kTiQzJE47fjRWJEckTyRJJCYkKyRKGyhC?=")))
|
278
|
-
end
|
279
|
-
end
|
280
|
-
end
|
281
|
-
end
|
282
|
-
|
283
|
-
context "with attachments" do
|
284
|
-
before(:each) do
|
285
|
-
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
|
286
|
-
@mail.mobile = @mobile
|
287
|
-
@mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
|
288
|
-
@photo = open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/photo.jpg")).read
|
289
|
-
end
|
290
|
-
|
291
|
-
it "should encodes itself successfully" do
|
292
|
-
@mail.attachments['photo.jpg'] = @photo
|
293
|
-
|
294
|
-
lambda {
|
295
|
-
@mail.to_s
|
296
|
-
}.should_not raise_error
|
297
|
-
end
|
298
|
-
|
299
|
-
it "should encodes itself successfully with an inline attachment" do
|
300
|
-
@mail.attachments.inline['photo.jpg'] = @photo
|
301
|
-
|
302
|
-
lambda {
|
303
|
-
@mail.to_s
|
304
|
-
}.should_not raise_error
|
305
|
-
end
|
306
|
-
|
307
|
-
it "should encodes itself successfully with an UTF-8 filename attachment" do
|
308
|
-
@mail.attachments.inline['日本語のファイル名です.jpg'] = @photo
|
309
|
-
|
310
|
-
lambda {
|
311
|
-
@mail.to_s
|
312
|
-
}.should_not raise_error
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
context "encoding conversion" do
|
317
|
-
before(:each) do
|
318
|
-
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
|
319
|
-
@mail.mobile = @mobile
|
320
|
-
@mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
|
321
|
-
@photo = open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/photo.jpg")).read
|
322
|
-
end
|
323
|
-
|
324
|
-
it "wave dash converting correctly" do
|
325
|
-
@mail.body = '10:00〜12:00'
|
326
|
-
|
327
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x31\x30\x3a\x30\x30\x1b\x24\x42\x21\x41\x1b\x28\x42\x31\x32\x3a\x30\x30"))))
|
328
|
-
end
|
329
|
-
|
330
|
-
it "full width tilde converting correctly" do
|
331
|
-
@mail.body = "10:00#{[0xff5e].pack("U")}12:00"
|
332
|
-
|
333
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x31\x30\x3a\x30\x30\x1b\x24\x42\x21\x41\x1b\x28\x42\x31\x32\x3a\x30\x30"))))
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
context "delivering" do
|
338
|
-
before(:each) do
|
339
|
-
@mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
|
340
|
-
@mail.mobile = @mobile
|
341
|
-
@mail.to = "むすめふさほせ <info+to@jpmobile-rails.org>"
|
342
|
-
end
|
343
|
-
|
344
|
-
it "delivers through SMTP" do
|
345
|
-
@mail.delivery_method :smtp, {:enable_starttls_auto => false}
|
346
|
-
lambda {
|
347
|
-
@mail.deliver
|
348
|
-
}.should_not raise_error
|
349
|
-
|
350
|
-
Mail::TestMailer.deliveries.size
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
context 'sending with carrier from' do
|
355
|
-
before do
|
356
|
-
@mail = Mail.new
|
357
|
-
@mail.subject = "万葉"
|
358
|
-
@mail.to = "ちはやふる <info@jpmobile-rails.org>"
|
359
|
-
end
|
360
|
-
|
361
|
-
it 'should convert content-transfer-encoding' do
|
362
|
-
mobile = Jpmobile::Mobile::Au.new(nil, nil)
|
363
|
-
@mail.content_transfer_encoding = 'base64'
|
364
|
-
@mail.body = ['ほげ'].pack('m')
|
365
|
-
@mail.charset = 'UTF-8'
|
366
|
-
|
367
|
-
@mail.mobile = mobile
|
368
|
-
@mail.from = '<えーゆー> au@ezweb.ne.jp'
|
369
|
-
|
370
|
-
@mail.encoded.should match(/content-transfer-encoding: 7bit/i)
|
371
|
-
end
|
372
|
-
|
373
|
-
it 'should not convert content-transfer-encoding with BINARY' do
|
374
|
-
mobile = Jpmobile::Mobile::Au.new(nil, nil)
|
375
|
-
data = ['ほげ'].pack('m').strip
|
376
|
-
|
377
|
-
@mail.content_transfer_encoding = 'base64'
|
378
|
-
@mail.content_type = 'image/jpeg'
|
379
|
-
@mail.body = data
|
380
|
-
@mail.charset = 'UTF-8'
|
381
|
-
|
382
|
-
@mail.mobile = mobile
|
383
|
-
@mail.from = '<えーゆー> au@ezweb.ne.jp'
|
384
|
-
|
385
|
-
@mail.encoded.should match(/content-transfer-encoding: base64/i)
|
386
|
-
@mail.encoded.should match(data)
|
387
|
-
end
|
388
|
-
end
|
389
232
|
end
|
@@ -105,7 +105,7 @@ describe "Jpmobile::Mail#receive" do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should encode correctly" do
|
108
|
-
ascii_8bit(@mail.to_s).should match(Regexp.escape("
|
108
|
+
ascii_8bit(@mail.to_s).should match(Regexp.escape("GyRCJUYlOSVIGyhCGyRCdk8bKEI="))
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -148,14 +148,6 @@ describe "Jpmobile::Mail#receive" do
|
|
148
148
|
end
|
149
149
|
end
|
150
150
|
end
|
151
|
-
|
152
|
-
context 'bounced mail' do
|
153
|
-
it 'should parse sub-part charset correctly' do
|
154
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/bounce_with_utf8_part.eml")).read)
|
155
|
-
@mail.parts.first.charset.should match(/iso-2022-jp/i)
|
156
|
-
@mail.parts.last.charset.should match(/utf-8/i)
|
157
|
-
end
|
158
|
-
end
|
159
151
|
end
|
160
152
|
|
161
153
|
describe "Docomo" do
|
@@ -209,49 +201,23 @@ describe "Jpmobile::Mail#receive" do
|
|
209
201
|
|
210
202
|
context "to_s" do
|
211
203
|
it "should have subject which is same as original" do
|
212
|
-
ascii_8bit(@mail.to_s).should match(Regexp.escape("
|
204
|
+
ascii_8bit(@mail.to_s).should match(Regexp.escape("GyRCQmpMPhsoQhskQnZeGyhC"))
|
213
205
|
end
|
214
206
|
|
215
207
|
it "should have body which is same as original" do
|
216
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("
|
208
|
+
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit(utf8_to_jis("本文")))))
|
217
209
|
end
|
218
210
|
end
|
219
211
|
|
220
212
|
context "modify and to_s" do
|
221
213
|
it "should encode subject correctly" do
|
222
214
|
@mail.subject = "大江戸"
|
223
|
-
ascii_8bit(@mail.to_s).should match(
|
215
|
+
ascii_8bit(@mail.to_s).should match("GyRCQmc5PjhNGyhCGyRCdUEbKEI=")
|
224
216
|
end
|
225
217
|
|
226
218
|
it "should encode body correctly" do
|
227
219
|
@mail.body = "会議が開催"
|
228
|
-
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x32\x71\x35\x44\x24\x2C\x33\x2B\x3A\x45\x75\x48\x1b\x28\x42"))))
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
context 'From au iPhone' do
|
233
|
-
it 'charset should be UTF-8' do
|
234
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-message.eml")).read)
|
235
|
-
@mail.mobile.should be_a(Jpmobile::Mobile::Au)
|
236
|
-
@mail.charset.should match(/utf-8/i)
|
237
|
-
end
|
238
|
-
|
239
|
-
it 'should be encoded correctly' do
|
240
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-message.eml")).read)
|
241
|
-
@mail.encoded
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
context 'From iPad' do
|
246
|
-
it 'charset should be UTF-8' do
|
247
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-mail3.eml")).read)
|
248
|
-
@mail.mobile.should be_a(Jpmobile::Mobile::AbstractMobile)
|
249
|
-
@mail.charset.should match(/utf-8/i)
|
250
|
-
end
|
251
|
-
|
252
|
-
it 'should be encoded correctly' do
|
253
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "email-fixtures/iphone-mail3.eml")).read)
|
254
|
-
@mail.encoded
|
220
|
+
ascii_8bit(@mail.to_s).should match(Regexp.compile(Regexp.escape(ascii_8bit("\x1b\x24\x42\x32\x71\x35\x44\x24\x2C\x33\x2B\x3A\x45\x1b\x28\x42\x1b\x24\x42\x75\x48\x1b\x28\x42"))))
|
255
221
|
end
|
256
222
|
end
|
257
223
|
end
|
@@ -322,18 +288,6 @@ describe "Jpmobile::Mail#receive" do
|
|
322
288
|
end
|
323
289
|
end
|
324
290
|
|
325
|
-
describe 'bounced mail' do
|
326
|
-
context "has jp address" do
|
327
|
-
before(:each) do
|
328
|
-
@mail = Mail.new(open(File.join(File.expand_path(File.dirname(__FILE__)), "../../test/rails/overrides/spec/fixtures/mobile_mailer/bounced-jp.eml")).read)
|
329
|
-
end
|
330
|
-
|
331
|
-
it "mobile should abstract mobile" do
|
332
|
-
@mail.mobile.should be_a Jpmobile::Mobile::AbstractMobile
|
333
|
-
end
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
291
|
describe "non-Japanese mail" do
|
338
292
|
context "us-ascii" do
|
339
293
|
before(:each) do
|
data/spec/unit/spec_helper.rb
CHANGED
data/spec/unit/util_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
|
|
3
3
|
require 'stringio'
|
4
4
|
require 'nkf'
|
5
5
|
|
6
|
-
describe Jpmobile::Util do
|
6
|
+
describe Jpmobile::Util, ".deep_apply" do
|
7
7
|
include Jpmobile::Util
|
8
8
|
|
9
9
|
it 'nilのときはnilを返すこと' do
|
@@ -34,8 +34,8 @@ describe Jpmobile::Util do
|
|
34
34
|
utf8_to_sjis("اللغة العربية").should == sjis("????? ???????")
|
35
35
|
end
|
36
36
|
|
37
|
-
it "utf8_to_sjis
|
38
|
-
utf8_to_sjis("UTF8\
|
37
|
+
it "utf8_to_sjis で改行コードが CRLF に変更されること" do
|
38
|
+
utf8_to_sjis("UTF8\nTEXT\n").should == sjis("UTF8\r\nTEXT\r\n")
|
39
39
|
end
|
40
40
|
|
41
41
|
it "0x8150がU+FFE3に変換されること" do
|
@@ -63,22 +63,6 @@ describe Jpmobile::Util do
|
|
63
63
|
jis_to_utf8(jis("\x1b\x24\x42#{$1}\x1b\x28\x42")).should == "しからずんばこじをえず"
|
64
64
|
end
|
65
65
|
|
66
|
-
it "sjis_to_utf8 ですべての改行コードが LF に変更されること" do
|
67
|
-
sjis_to_utf8("SJIS\rSAMPLE\nTEXT\r\n").should == utf8("SJIS\nSAMPLE\nTEXT\n")
|
68
|
-
end
|
69
|
-
|
70
|
-
it "utf8_to_sjis で変換できない文字列が含んでいた場合?に変換される" do
|
71
|
-
utf8_to_jis("اللغة العربية").should == jis("????? ???????")
|
72
|
-
end
|
73
|
-
|
74
|
-
it "utf8_to_jis ですべての改行コードが CRLF に変更されること" do
|
75
|
-
utf8_to_jis("UTF8\rSAMPLE\nTEXT\r\n").should == jis("UTF8\r\nSAMPLE\r\nTEXT\r\n")
|
76
|
-
end
|
77
|
-
|
78
|
-
it "jis_to_utf8 ですべての改行コードが LF に変更されること" do
|
79
|
-
jis_to_utf8("JIS\rSAMPLE\nTEXT\r\n").should == utf8("JIS\nSAMPLE\nTEXT\n")
|
80
|
-
end
|
81
|
-
|
82
66
|
it "fold_textでUTF-8の日本語文字列が指定文字数で折り返された配列で返ること" do
|
83
67
|
fold_text('長い日本語の題名で折り返されるかようにするには事前に分割していないとダメなことがわかりましたよ', 15).should == [
|
84
68
|
'長い日本語の題名で折り返される',
|
@@ -103,47 +87,4 @@ describe Jpmobile::Util do
|
|
103
87
|
split_text('', 15).should be_nil
|
104
88
|
split_text(nil, 15).should be_nil
|
105
89
|
end
|
106
|
-
|
107
|
-
it "全角チルダがjisに適切に変換されること" do
|
108
|
-
ascii_8bit(utf8_to_jis("\xef\xbd\x9e")).should == ascii_8bit("\x1b\x24\x42\x21\x41\x1b\x28\x42")
|
109
|
-
ascii_8bit(encode("\xef\xbd\x9e", "ISO-2022-JP")).should == ascii_8bit("\x1b\x24\x42\x21\x41\x1b\x28\x42")
|
110
|
-
end
|
111
|
-
|
112
|
-
describe 'invert_table' do
|
113
|
-
it 'pickups the first(least) of duplicated values when inverting hash table' do
|
114
|
-
hash = invert_table({
|
115
|
-
0xFE009 => 0xE63E,
|
116
|
-
0xFE00A => 0xE63E,
|
117
|
-
0xFE00B => 0x3013,
|
118
|
-
0xFE010 => 0xE6B3,
|
119
|
-
0xFE038 => 0xE73F})
|
120
|
-
hash[0xE63E].should == 0xFE009
|
121
|
-
hash[0x3013].should == 0xFE00B
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'should not raise error when hash has Array keys' do
|
125
|
-
hash = invert_table({
|
126
|
-
[0x1F1E8, 0x1F1F3] => 0x3013,
|
127
|
-
0x1F1FF => 0x3013,
|
128
|
-
0x1F526 => 0xE6FB,
|
129
|
-
[0x0023, 0x20E3] => 0xE6E0,
|
130
|
-
0x1F354 => 0xE673})
|
131
|
-
hash[0x3013].should == [0x1F1E8, 0x1F1F3]
|
132
|
-
hash[0xE6FB].should == 0x1F526
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
describe 'check_charset' do
|
137
|
-
it 'returns true if compatible' do
|
138
|
-
str = ascii_8bit('ABC')
|
139
|
-
check_charset(str, 'UTF-8').should be_true
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe 'correct_encoding' do
|
144
|
-
it 'updates encoding correctly' do
|
145
|
-
str = jis('再現')
|
146
|
-
utf8?(correct_encoding(str)).should be_true
|
147
|
-
end
|
148
|
-
end
|
149
90
|
end
|
@@ -13,17 +13,5 @@ class TemplatePathController < ApplicationController
|
|
13
13
|
def optioned_index
|
14
14
|
render :action => "index"
|
15
15
|
end
|
16
|
-
|
17
|
-
def full_path_partial
|
18
|
-
end
|
19
|
-
|
20
|
-
def smart_phone_only
|
21
|
-
end
|
22
|
-
|
23
|
-
def with_tblt
|
24
|
-
end
|
25
|
-
|
26
|
-
def with_ipd
|
27
|
-
end
|
28
16
|
end
|
29
17
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
class MobileMailer < Jpmobile::Mailer::Base
|
3
3
|
default :from => "info@jp.mobile"
|
4
|
-
default :to => "info@jp.mobile"
|
5
4
|
|
6
5
|
def view_selection(to_mail, subject_text, text)
|
7
6
|
@text = text
|
@@ -15,11 +14,6 @@ class MobileMailer < Jpmobile::Mailer::Base
|
|
15
14
|
def multi_message(to_mail, subject_text, text, html)
|
16
15
|
@html = html
|
17
16
|
@text = text
|
18
|
-
mail(:to => to_mail, :subject =>
|
19
|
-
end
|
20
|
-
|
21
|
-
def default_to_mail(subject_text, text)
|
22
|
-
@text = text
|
23
|
-
mail(:subject => subject_text)
|
17
|
+
mail(:to => to_mail, :subject => subject_text)
|
24
18
|
end
|
25
19
|
end
|