Permalink
Browse files

- Use binread (and emulate in ruby 1.8) to avoid encoding issues

[git-p4: depot-paths = "//src/ruby_parser/dev/": change = 7293]
  • Loading branch information...
1 parent 2ce07e7 commit 1fda743fecc95ae59c5bffb3614e82d8e9b383ab @zenspider zenspider committed Apr 5, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 bin/ruby_parse
View
@@ -17,6 +17,14 @@ times = {}
locs = {}
kbytes = {}
+class File
+ RUBY19 = "<3".respond_to? :encoding
+
+ class << self
+ alias :binread :read unless RUBY19
+ end
+end
+
begin
ARGV.each do |file|
rp = RubyParser.new
@@ -37,7 +45,7 @@ begin
begin
begin
rp.reset
- r = rp.parse(File.read(file), file)
+ r = rp.parse(File.binread(file), file)
pp r unless $q
good += 1
rescue SyntaxError => e

0 comments on commit 1fda743

Please sign in to comment.