Loading lib/jsduck/util/io.rb +6 −2 Original line number Diff line number Diff line Loading @@ -28,11 +28,15 @@ module JsDuck File.open(filename, "r:"+@@encoding) {|f| self.strip_utf8_bom(f.read) } end # Takes care of removing UTF-8 byte order mark in Ruby 1.8 which # Takes care of removing UTF-8 byte order mark in Ruby <= 1.8 which # doesn't have built-in encodings support. def self.strip_utf8_bom(string) if "".respond_to?(:encoding) string else string.sub(/\A\xEF\xBB\xBF/, "") end end end Loading Loading
lib/jsduck/util/io.rb +6 −2 Original line number Diff line number Diff line Loading @@ -28,11 +28,15 @@ module JsDuck File.open(filename, "r:"+@@encoding) {|f| self.strip_utf8_bom(f.read) } end # Takes care of removing UTF-8 byte order mark in Ruby 1.8 which # Takes care of removing UTF-8 byte order mark in Ruby <= 1.8 which # doesn't have built-in encodings support. def self.strip_utf8_bom(string) if "".respond_to?(:encoding) string else string.sub(/\A\xEF\xBB\xBF/, "") end end end Loading