Skip to content

Commit cff6fab

Browse files
committed
Work round Jekyll issue with surrogate pairs
1 parent f2ac60f commit cff6fab

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎_plugins/setup.rb‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
module Setup
2222
require 'uri'
23+
require 'json'
2324
require 'net/http'
2425

2526
# Hash: key: target file, value: source
@@ -41,7 +42,8 @@ module Setup
4142
puts "Setup: #{data_file} is old or missing"
4243
uri = URI.parse(data_src)
4344
response = Net::HTTP.get_response uri
44-
File.write(data_file, response.body)
45+
# Use JSON parse and dump to avoid problenms with surrogate pairs when parsed by Jekyll (which uses yaml gem)
46+
File.write(data_file, JSON.dump(JSON.parse(response.body)))
4547
else
4648
puts "Setup: #{data_file} is recent"
4749
end

0 commit comments

Comments
 (0)