From 475c435d4b93c0cda5f5cd8d7986e89124a0a5fa Mon Sep 17 00:00:00 2001 From: SukramJ Date: Sat, 14 Dec 2024 14:22:50 +0100 Subject: [PATCH] Add missing encoding to unquote --- changelog.md | 4 ++++ hahomematic/client/json_rpc.py | 7 +++---- hahomematic/const.py | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/changelog.md b/changelog.md index 7d7d59cb..5fadfe4c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,7 @@ +# Version 2024.12.4 (2024-12-14) + +- Add missing encoding to unquote + # Version 2024.12.3 (2024-12-14) - Add method cleanup_text_from_html_tags diff --git a/hahomematic/client/json_rpc.py b/hahomematic/client/json_rpc.py index 556a1e29..ef4a6d15 100644 --- a/hahomematic/client/json_rpc.py +++ b/hahomematic/client/json_rpc.py @@ -26,6 +26,7 @@ from hahomematic.const import ( DESCRIPTIONS_ERROR_MESSAGE, EXTENDED_SYSVAR_MARKER, + ISO88591, PATH_JSON_RPC, REGA_SCRIPT_PATH, UTF8, @@ -594,9 +595,8 @@ async def _get_program_descriptions(self) -> dict[str, str]: _LOGGER.debug("GET_PROGRAM_DESCRIPTIONS: Getting program descriptions") if json_result := response[_JsonKey.RESULT]: for data in json_result: - decoded_text = unquote(string=data[_JsonKey.DESCRIPTION]) descriptions[data[_JsonKey.ID]] = cleanup_text_from_html_tags( - text=decoded_text + text=unquote(string=data[_JsonKey.DESCRIPTION], encoding=ISO88591) ) except JSONDecodeError as err: _LOGGER.error( @@ -617,9 +617,8 @@ async def _get_system_variable_descriptions(self) -> dict[str, str]: _LOGGER.debug("GET_SYSTEM_VARIABLE_DESCRIPTIONS: Getting system variable descriptions") if json_result := response[_JsonKey.RESULT]: for data in json_result: - decoded_text = unquote(string=data[_JsonKey.DESCRIPTION]) descriptions[data[_JsonKey.ID]] = cleanup_text_from_html_tags( - text=decoded_text + text=unquote(string=data[_JsonKey.DESCRIPTION], encoding=ISO88591) ) except JSONDecodeError as err: _LOGGER.error( diff --git a/hahomematic/const.py b/hahomematic/const.py index 3df93bcc..7459b974 100644 --- a/hahomematic/const.py +++ b/hahomematic/const.py @@ -9,7 +9,7 @@ import re from typing import Any, Final, Required, TypedDict -VERSION: Final = "2024.12.3" +VERSION: Final = "2024.12.4" DEFAULT_CONNECTION_CHECKER_INTERVAL: Final = 15 # check if connection is available via rpc ping DEFAULT_CUSTOM_ID: Final = "custom_id" @@ -33,6 +33,7 @@ DEFAULT_WAIT_FOR_CALLBACK: Final[int | None] = None UTF8: Final = "utf-8" +ISO88591: Final = "iso-8859-1" MAX_WAIT_FOR_CALLBACK: Final = 60 MAX_CACHE_AGE: Final = 10