From 155499fafe6eaffd943bd6320db7185b08ae3ac4 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 2 Feb 2024 02:00:46 -0600 Subject: [PATCH] Load json file as binary instead of decoding to string (#109351) --- homeassistant/util/json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/util/json.py b/homeassistant/util/json.py index 630c39b3ad4..65f93020cc6 100644 --- a/homeassistant/util/json.py +++ b/homeassistant/util/json.py @@ -74,7 +74,7 @@ def load_json( Defaults to returning empty dict if file is not found. """ try: - with open(filename, encoding="utf-8") as fdesc: + with open(filename, mode="rb") as fdesc: return orjson.loads(fdesc.read()) # type: ignore[no-any-return] except FileNotFoundError: # This is not a fatal error