From 3bf611776e312aeaa5c4c3bcde2d3ce3669cab85 Mon Sep 17 00:00:00 2001 From: Rich Kuzsma Date: Sat, 18 Feb 2017 21:30:59 -0500 Subject: [PATCH] Force UTF-8 encoding when reading HAR files Would you consider making the HAR file encoding more explicit? http://www.softwareishard.com/blog/har-12-spec/ says that HAR archives must be in UTF-8 format. An approach like this proposed change could fix issues on operating systems in which the default file encoding is not UTF-8. --- lib/har/archive.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/har/archive.rb b/lib/har/archive.rb index d5417e7..f10e601 100644 --- a/lib/har/archive.rb +++ b/lib/har/archive.rb @@ -9,7 +9,7 @@ def self.from_string(str, uri = nil) def self.from_file(path_or_io) case path_or_io when String - from_string File.read(path_or_io), path_or_io + from_string File.read(path_or_io, :encoding => 'utf-8'), path_or_io when IO from_string path_or_io.read, path_or_io.to_s else