From c6d5a913f1d420c7da93f697a223bc02ef10a1be Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 13 Feb 2015 19:39:15 -0800 Subject: [PATCH] Site#read_data_file: read CSV's with proper file encoding Fixes #3451. --- lib/jekyll/site.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 3af47672..100f50f1 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -262,19 +262,22 @@ module Jekyll end end end - + # Determines how to read a data file. # # Returns the contents of the data file. def read_data_file(path) case File.extname(path).downcase when '.csv' - CSV.read(path, :headers => true).map(&:to_hash) + CSV.read(path, { + :headers => true, + :encoding => config['encoding'] + }).map(&:to_hash) else SafeYAML.load_file(path) end end - + # Read in all collections specified in the configuration # # Returns nothing.