File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -953,15 +953,8 @@ def maybe_load_yaml path # :nodoc:
953953class File # :nodoc:
954954 # Like File::read, but strips out a BOM marker if it exists.
955955 def self . read_utf path
956- r19 = "<3" . respond_to? :encoding
957- opt = r19 ? "r:bom|utf-8" : "rb"
958-
959- open path , opt do |f |
960- if r19 then
961- f . read
962- else
963- f . read . sub %r%\A \xEF \xBB \xBF % , ""
964- end
956+ open path , "r:bom|utf-8" do |f |
957+ f . read
965958 end
966959 end
967960end
Original file line number Diff line number Diff line change @@ -192,10 +192,7 @@ def test_file_read_utf
192192
193193 content = File . read_utf io . path
194194 assert_equal "BOM" , content
195-
196- if content . respond_to? :encoding then
197- assert_equal Encoding ::UTF_8 , content . encoding
198- end
195+ assert_equal Encoding ::UTF_8 , content . encoding
199196 end
200197 end
201198
You can’t perform that action at this time.
0 commit comments