jruby /test/externals/ruby1.9/ruby/enc/test_emoji.rb

Language Ruby Lines 443
MD5 Hash b8f50a28dc528f5930f3f1b40ff232af Estimated Cost $8,865 (why?)
Repository https://bitbucket.org/nicksieger/jruby.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
require 'test/unit'

module Emoji

  class TestRenameSJIS < Test::Unit::TestCase
    def test_shift_jis
      assert_raise(ArgumentError) { "".force_encoding("Shift_JIS-DoCoMo") }
      assert_raise(ArgumentError) { "".force_encoding("Shift_JIS-KDDI") }
      assert_raise(ArgumentError) { "".force_encoding("Shift_JIS-SoftBank") }
    end
  end

  class TestUTF8_BLACK_SUN_WITH_RAYS < Test::Unit::TestCase
    include Emoji

    def setup
      @codes = {
        "UTF8-DoCoMo"     => utf8_docomo("\u{E63E}"),
        "UTF8-KDDI"       => utf8_kddi("\u{E488}"),
        "UTF8-SoftBank"   => utf8_softbank("\u{E04A}"),
        "UTF-8"           => "\u{2600}",
      }
    end

    def test_convert
      @codes.each do |from_enc, from_str|
        @codes.each do |to_enc, to_str|
          next if from_enc == to_enc
          assert_equal to_str, from_str.encode(to_enc), "convert from #{from_enc} to #{to_enc}"
        end
      end
    end
  end

  class TestDoCoMo < Test::Unit::TestCase
    include Emoji

    def setup
      setup_instance_variable(self)
    end

    def test_encoding_name
      %w(UTF8-DoCoMo
         SJIS-DoCoMo).each do |n|
        assert Encoding.name_list.include?(n), "encoding not found: #{n}"
      end
    end

    def test_comparison
      assert_not_equal Encoding::UTF_8, Encoding::UTF8_DoCoMo
      assert_not_equal Encoding::Windows_31J, Encoding::SJIS_DoCoMo
    end

    def test_from_utf8
      assert_nothing_raised { assert_equal utf8_docomo(@aiueo_utf8), to_utf8_docomo(@aiueo_utf8) }
      assert_nothing_raised { assert_equal sjis_docomo(@aiueo_sjis), to_sjis_docomo(@aiueo_utf8) }
    end

    def test_from_sjis
      assert_nothing_raised { assert_equal utf8_docomo(@aiueo_utf8), to_utf8_docomo(@aiueo_sjis) }
      assert_nothing_raised { assert_equal sjis_docomo(@aiueo_sjis), to_sjis_docomo(@aiueo_sjis) }
    end

    def test_to_utf8
      assert_nothing_raised { assert_equal @utf8, to_utf8(@utf8_docomo) }
      assert_nothing_raised { assert_equal @utf8, to_utf8(@sjis_docomo) }
    end

    def test_to_sjis
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@utf8_docomo) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@sjis_docomo) }
    end

    def test_to_eucjp
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@utf8_docomo) }
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@sjis_docomo) }
    end

    def test_docomo
      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@sjis_docomo) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@utf8_docomo) }
    end

    def test_to_kddi
      assert_nothing_raised { assert_equal @utf8_kddi, to_utf8_kddi(@utf8_docomo) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@utf8_docomo) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@utf8_docomo) }

      assert_nothing_raised { assert_equal @utf8_kddi, to_utf8_kddi(@sjis_docomo) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@sjis_docomo) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@sjis_docomo) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_kddi(@utf8_docomo_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_kddi(@utf8_docomo_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_iso2022jp_kddi(@utf8_docomo_only) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_kddi(@sjis_docomo_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_kddi(@sjis_docomo_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_iso2022jp_kddi(@sjis_docomo_only) }
    end

    def test_to_softbank
      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@utf8_docomo) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@utf8_docomo) }

      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@sjis_docomo) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@sjis_docomo) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_softbank(@utf8_docomo_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_softbank(@utf8_docomo_only) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_softbank(@sjis_docomo_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_softbank(@sjis_docomo_only) }
    end
  end

  class TestKDDI < Test::Unit::TestCase
    include Emoji

    def setup
      setup_instance_variable(self)
    end

    def test_encoding_name
      %w(UTF8-KDDI
         SJIS-KDDI
         ISO-2022-JP-KDDI
         stateless-ISO-2022-JP-KDDI).each do |n|
        assert Encoding.name_list.include?(n), "encoding not found: #{n}"
      end
    end

    def test_comparison
      assert_not_equal Encoding::UTF_8, Encoding::UTF8_KDDI
      assert_not_equal Encoding::Windows_31J, Encoding::SJIS_KDDI
      assert_not_equal Encoding::ISO_2022_JP, Encoding::ISO_2022_JP_KDDI
      assert_not_equal Encoding::Stateless_ISO_2022_JP, Encoding::Stateless_ISO_2022_JP_KDDI
    end

    def test_from_utf8
      assert_nothing_raised { assert_equal utf8_kddi(@aiueo_utf8), to_utf8_kddi(@aiueo_utf8) }
      assert_nothing_raised { assert_equal sjis_kddi(@aiueo_sjis), to_sjis_kddi(@aiueo_utf8) }
      assert_nothing_raised { assert_equal iso2022jp_kddi(@aiueo_iso2022jp), to_iso2022jp_kddi(@aiueo_utf8) }
    end

    def test_from_sjis
      assert_nothing_raised { assert_equal utf8_kddi(@aiueo_utf8), to_utf8_kddi(@aiueo_sjis) }
      assert_nothing_raised { assert_equal sjis_kddi(@aiueo_sjis), to_sjis_kddi(@aiueo_sjis) }
      assert_nothing_raised { assert_equal iso2022jp_kddi(@aiueo_iso2022jp), to_iso2022jp_kddi(@aiueo_sjis) }
    end

    def test_from_iso2022jp
      assert_nothing_raised { assert_equal utf8_kddi(@aiueo_utf8), to_utf8_kddi(@aiueo_iso2022jp) }
      assert_nothing_raised { assert_equal sjis_kddi(@aiueo_sjis), to_sjis_kddi(@aiueo_iso2022jp) }
      assert_nothing_raised { assert_equal iso2022jp_kddi(@aiueo_iso2022jp), to_iso2022jp_kddi(@aiueo_iso2022jp) }
    end

    def test_to_utf8
      assert_nothing_raised { assert_equal @utf8, to_utf8(@utf8_kddi) }
      assert_nothing_raised { assert_equal @utf8, to_utf8(@utf8_undoc_kddi) }
      assert_nothing_raised { assert_equal @utf8, to_utf8(@sjis_kddi) }
      assert_nothing_raised { assert_equal @utf8, to_utf8(@iso2022jp_kddi) }
    end

    def test_to_sjis
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@utf8_kddi) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@utf8_undoc_kddi) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@sjis_kddi) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@iso2022jp_kddi) }
    end

    def test_to_eucjp
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@utf8_kddi) }
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@utf8_undoc_kddi) }
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@sjis_kddi) }
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@iso2022jp_kddi) }
    end

    def test_kddi
      assert_nothing_raised { assert_equal @utf8_kddi, to_utf8_kddi(@sjis_kddi) }
      assert_nothing_raised { assert_equal @utf8_kddi, to_utf8_kddi(@iso2022jp_kddi) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@sjis_kddi) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@utf8_undoc_kddi) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@iso2022jp_kddi) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@sjis_kddi) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@utf8_undoc_kddi) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@iso2022jp_kddi) }
    end

    def test_to_docomo
      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@utf8_kddi) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@utf8_kddi) }

      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@utf8_undoc_kddi) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@utf8_undoc_kddi) }

      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@sjis_kddi) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@sjis_kddi) }

      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@iso2022jp_kddi) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@iso2022jp_kddi) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_docomo, to_utf8_docomo(@utf8_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_docomo, to_sjis_docomo(@utf8_kddi_only) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_docomo, to_utf8_docomo(@utf8_undoc_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_docomo, to_sjis_docomo(@utf8_undoc_kddi_only) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_docomo, to_utf8_docomo(@sjis_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_docomo, to_sjis_docomo(@sjis_kddi_only) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_docomo, to_utf8_docomo(@iso2022jp_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_docomo, to_sjis_docomo(@iso2022jp_kddi_only) }
    end

    def test_to_softbank
      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@utf8_kddi) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@utf8_kddi) }

      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@utf8_undoc_kddi) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@utf8_undoc_kddi) }

      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@sjis_kddi) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@sjis_kddi) }

      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@iso2022jp_kddi) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@iso2022jp_kddi) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_softbank, to_utf8_softbank(@utf8_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_softbank, to_sjis_softbank(@utf8_kddi_only) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_softbank, to_utf8_softbank(@utf8_undoc_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_softbank, to_sjis_softbank(@utf8_undoc_kddi_only) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_softbank, to_utf8_softbank(@sjis_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_softbank, to_sjis_softbank(@sjis_kddi_only) }

      assert_raise(Encoding::UndefinedConversionError) { assert_equal @utf8_softbank, to_utf8_softbank(@iso2022jp_kddi_only) }
      assert_raise(Encoding::UndefinedConversionError) { assert_equal @sjis_softbank, to_sjis_softbank(@iso2022jp_kddi_only) }
    end
  end

  class TestSoftBank < Test::Unit::TestCase
    include Emoji

    def setup
      setup_instance_variable(self)
    end

    def test_encoding_name
      %w(UTF8-SoftBank
         SJIS-SoftBank).each do |n|
        assert Encoding.name_list.include?(n), "encoding not found: #{n}"
      end
    end

    def test_comparison
      assert_not_equal Encoding::UTF_8, Encoding::UTF8_SoftBank
      assert_not_equal Encoding::Windows_31J, Encoding::SJIS_SoftBank
    end

    def test_from_utf8
      assert_nothing_raised { assert_equal utf8_softbank(@aiueo_utf8), to_utf8_softbank(@aiueo_utf8) }
      assert_nothing_raised { assert_equal sjis_softbank(@aiueo_sjis), to_sjis_softbank(@aiueo_utf8) }
    end

    def test_from_sjis
      assert_nothing_raised { assert_equal utf8_softbank(@aiueo_utf8), to_utf8_softbank(@aiueo_sjis) }
      assert_nothing_raised { assert_equal sjis_softbank(@aiueo_sjis), to_sjis_softbank(@aiueo_sjis) }
    end

    def test_to_utf8
      assert_nothing_raised { assert_equal @utf8, to_utf8(@utf8_softbank) }
      assert_nothing_raised { assert_equal @utf8, to_utf8(@sjis_softbank) }
    end

    def test_to_sjis
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@utf8_softbank) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis(@sjis_softbank) }
    end

    def test_to_eucjp
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@utf8_softbank) }
      assert_raise(Encoding::UndefinedConversionError) { to_eucjp(@sjis_softbank) }
    end

    def test_softbank
      assert_nothing_raised { assert_equal @utf8_softbank, to_utf8_softbank(@sjis_softbank) }
      assert_nothing_raised { assert_equal @sjis_softbank, to_sjis_softbank(@utf8_softbank) }
    end

    def test_to_docomo
      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@utf8_softbank) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@utf8_softbank) }

      assert_nothing_raised { assert_equal @utf8_docomo, to_utf8_docomo(@sjis_softbank) }
      assert_nothing_raised { assert_equal @sjis_docomo, to_sjis_docomo(@sjis_softbank) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_docomo(@utf8_softbank_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_docomo(@utf8_softbank_only) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_docomo(@sjis_softbank_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_docomo(@sjis_softbank_only) }
    end

    def test_to_kddi
      assert_nothing_raised { assert_equal @utf8_kddi, to_utf8_kddi(@utf8_softbank) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@utf8_softbank) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@utf8_softbank) }

      assert_nothing_raised { assert_equal @utf8_kddi, to_utf8_kddi(@sjis_softbank) }
      assert_nothing_raised { assert_equal @sjis_kddi, to_sjis_kddi(@sjis_softbank) }
      assert_nothing_raised { assert_equal @iso2022jp_kddi, to_iso2022jp_kddi(@sjis_softbank) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_kddi(@utf8_softbank_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_kddi(@utf8_softbank_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_iso2022jp_kddi(@utf8_softbank_only) }

      assert_raise(Encoding::UndefinedConversionError) { to_utf8_kddi(@sjis_softbank_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_sjis_kddi(@sjis_softbank_only) }
      assert_raise(Encoding::UndefinedConversionError) { to_iso2022jp_kddi(@sjis_softbank_only) }
    end
  end

  private

  def setup_instance_variable(obj)
    obj.instance_eval do
      @aiueo_utf8 = "\u{3042}\u{3044}\u{3046}\u{3048}\u{304A}"
      @aiueo_sjis = to_sjis(@aiueo_utf8)
      @aiueo_iso2022jp = to_iso2022jp(@aiueo_utf8)

      @utf8 = "\u{2600}"

      @utf8_docomo = utf8_docomo("\u{E63E}")
      @sjis_docomo = sjis_docomo("\xF8\x9F")
      @utf8_docomo_only = utf8_docomo("\u{E6B1}")
      @sjis_docomo_only = sjis_docomo("\xF9\x55")

      @utf8_kddi = utf8_kddi("\u{E488}")
      @utf8_undoc_kddi = utf8_kddi("\u{EF60}")
      @sjis_kddi = sjis_kddi("\xF6\x60")
      @iso2022jp_kddi = iso2022jp_kddi("\x1B$B\x75\x41\x1B(B")
      @stateless_iso2022jp_kddi = stateless_iso2022jp_kddi("\x92\xF5\xC1")
      @utf8_kddi_only = utf8_kddi("\u{E5B3}")
      @utf8_undoc_kddi_only = utf8_kddi("\u{F0D0}")
      @sjis_kddi_only = sjis_kddi("\xF7\xD0")
      @iso2022jp_kddi_only = iso2022jp_kddi("\x1B$B\x78\x52\x1B(B")
      @stateless_iso2022jp_kddi_only = stateless_iso2022jp_kddi("\x92\xF8\xD2")

      @utf8_softbank = utf8_softbank("\u{E04A}")
      @sjis_softbank = sjis_softbank("\xF9\x8B")
      @utf8_softbank_only = utf8_softbank("\u{E524}")
      @sjis_softbank_only = sjis_softbank("\xFB\xC4")
    end
  end

  def utf8(str)
    str.force_encoding("UTF-8")
  end

  def to_utf8(str)
    str.encode("UTF-8")
  end

  def to_sjis(str)
    str.encode("Windows-31J")
  end

  def to_eucjp(str)
    str.encode("eucJP-ms")
  end

  def to_iso2022jp(str)
    str.encode("ISO-2022-JP")
  end

  def utf8_docomo(str)
    str.force_encoding("UTF8-DoCoMo")
  end

  def to_utf8_docomo(str)
    str.encode("UTF8-DoCoMo")
  end

  def utf8_kddi(str)
    str.force_encoding("UTF8-KDDI")
  end

  def to_utf8_kddi(str)
    str.encode("UTF8-KDDI")
  end

  def utf8_softbank(str)
    str.force_encoding("UTF8-SoftBank")
  end

  def to_utf8_softbank(str)
    str.encode("UTF8-SoftBank")
  end

  def sjis_docomo(str)
    str.force_encoding("SJIS-DoCoMo")
  end

  def to_sjis_docomo(str)
    str.encode("SJIS-DoCoMo")
  end

  def sjis_kddi(str)
    str.force_encoding("SJIS-KDDI")
  end

  def to_sjis_kddi(str)
    str.encode("SJIS-KDDI")
  end

  def sjis_softbank(str)
    str.force_encoding("SJIS-SoftBank")
  end

  def to_sjis_softbank(str)
    str.encode("SJIS-SoftBank")
  end

  def iso2022jp_kddi(str)
    str.force_encoding("ISO-2022-JP-KDDI")
  end

  def to_iso2022jp_kddi(str)
    str.encode("ISO-2022-JP-KDDI")
  end

  def stateless_iso2022jp_kddi(str)
    str.force_encoding("stateless-ISO-2022-JP-KDDI")
  end

  def to_stateless_iso2022jp_kddi(str)
    str.encode("stateless-ISO-2022-JP-KDDI")
  end

end
Back to Top