Sha256: 6423c4afd7f5450633e54d8fccfbc35d1d027e671a3ba34dea25bee86e6c7c9c

Contents?: true

Size: 564 Bytes

Versions: 33

Compression:

Stored size: 564 Bytes

Contents

require 'test/unit'
require 'nodejs'
require 'nodejs/file'

class TestNodejsFileEncoding < Test::Unit::TestCase

  def test_force_encoding_raw_text_to_utf8
    raw_text = 'çéà'
    assert_equal(raw_text.encoding, Encoding::UTF_8)
    utf8_text = raw_text.force_encoding('utf-8')
    assert_equal("çéà", utf8_text)
  end

  def test_force_encoding_from_binary_to_utf8
    raw_text = "\xC3\xA7\xC3\xA9\xC3\xA0"
    assert_equal(raw_text.encoding, Encoding::UTF_8)
    utf8_text = raw_text.force_encoding('utf-8')
    assert_equal("çéà", utf8_text)
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
opal-1.4.0 test/nodejs/test_file_encoding.rb
opal-1.4.0.alpha1 test/nodejs/test_file_encoding.rb
opal-1.3.2 test/nodejs/test_file_encoding.rb
opal-1.3.1 test/nodejs/test_file_encoding.rb
opal-1.3.0 test/nodejs/test_file_encoding.rb
opal-1.3.0.rc1 test/nodejs/test_file_encoding.rb
opal-1.3.0.alpha1 test/nodejs/test_file_encoding.rb
opal-1.2.0 test/nodejs/test_file_encoding.rb
opal-1.2.0.beta1 test/nodejs/test_file_encoding.rb
opal-1.1.1 test/nodejs/test_file_encoding.rb
opal-1.1.1.rc1 test/nodejs/test_file_encoding.rb
opal-1.1.0 test/nodejs/test_file_encoding.rb
opal-1.1.0.rc1 test/nodejs/test_file_encoding.rb