Skip to content

Commit

Permalink
Merge pull request #1827 from opal/revert-1824-node-binread
Browse files Browse the repository at this point in the history
Revert "Implement binread (mimic ASCII-8BIT encoding)"
  • Loading branch information
elia committed May 16, 2018
2 parents a7124ee + f9e50a9 commit 2c2093c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
2 changes: 1 addition & 1 deletion stdlib/nodejs/io.rb
Expand Up @@ -36,7 +36,7 @@ def self.read(path)
end

def self.binread(path)
`return executeIOAction(function(){return __fs__.readFileSync(#{path}).toString('utf-8')})`
`return executeIOAction(function(){return __fs__.readFileSync(#{path}).toString('binary')})`
end
end

Expand Down
6 changes: 0 additions & 6 deletions test/nodejs/test_io.rb
Expand Up @@ -15,10 +15,4 @@ def test_binread_noexistent_should_raise_io_error
IO.binread('tmp/nonexistent')
end
end

def test_binread_encoding
File.write('tmp/foo', 'Le français c\'est compliqué :)\n')
assert_equal("Le fran\xC3\xA7ais c'est compliqu\xC3\xA9 :)\\n", IO.binread('tmp/foo'))
assert_equal("Le français c'est compliqué :)\\n", IO.binread('tmp/foo'))
end
end

0 comments on commit 2c2093c

Please sign in to comment.