Merge pull request #19864 from Homebrew/api-utf8

api: force encoding to UTF-8
This commit is contained in:
Mike McQuaid 2025-05-01 07:34:57 +00:00 committed by GitHub
commit bbac5be4d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ module Homebrew
mtime = insecure_download ? Time.new(1970, 1, 1) : Time.now
FileUtils.touch(target, mtime:) unless skip_download
JSON.parse(target.read, freeze: true)
JSON.parse(target.read(encoding: Encoding::UTF_8), freeze: true)
rescue JSON::ParserError
target.unlink
retry_count += 1