From df676f30d1b8ba2c20d5228db97e01d2966b8dd6 Mon Sep 17 00:00:00 2001 From: Ishigh <45936615+Ishigh1@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:07:08 +0100 Subject: [PATCH 1/3] Added some resilience to non-ASCII player names or items --- worlds/ladx/LADXR/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worlds/ladx/LADXR/utils.py b/worlds/ladx/LADXR/utils.py index fcf1d2bb56e7..5f8b2685550d 100644 --- a/worlds/ladx/LADXR/utils.py +++ b/worlds/ladx/LADXR/utils.py @@ -146,7 +146,7 @@ def setReplacementName(key: str, value: str) -> None: def formatText(instr: str, *, center: bool = False, ask: Optional[str] = None) -> bytes: instr = instr.format(**_NAMES) - s = instr.encode("ascii") + s = instr.encode("ascii", errors="replace") s = s.replace(b"'", b"^") def padLine(line: bytes) -> bytes: @@ -169,7 +169,7 @@ def padLine(line: bytes) -> bytes: if result_line: result += padLine(result_line) if ask is not None: - askbytes = ask.encode("ascii") + askbytes = ask.encode("ascii", errors="replace") result = result.rstrip() while len(result) % 32 != 16: result += b' ' From 7fec190ed74f7058c774b92ab6fb4b47fda75bba Mon Sep 17 00:00:00 2001 From: Ishigh <45936615+Ishigh1@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:28:56 +0100 Subject: [PATCH 2/3] Also the client, not even sure if switching to ascii is useful here --- LinksAwakeningClient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LinksAwakeningClient.py b/LinksAwakeningClient.py index f3fc9d2cdb72..cc968ad9adaf 100644 --- a/LinksAwakeningClient.py +++ b/LinksAwakeningClient.py @@ -348,7 +348,7 @@ async def wait_for_retroarch_connection(self): await asyncio.sleep(1.0) continue self.stop_bizhawk_spam = False - logger.info(f"Connected to Retroarch {version.decode('ascii')} running {rom_name.decode('ascii')}") + logger.info(f"Connected to Retroarch {version.decode('ascii', errors='replace')} running {rom_name.decode('ascii', errors='replace')}") return except (BlockingIOError, TimeoutError, ConnectionResetError): await asyncio.sleep(1.0) From d418c7027fa7e14a11d5415b86a441e8e7932eb2 Mon Sep 17 00:00:00 2001 From: Ishigh <45936615+Ishigh1@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:49:53 +0100 Subject: [PATCH 3/3] Split a long line in two --- LinksAwakeningClient.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LinksAwakeningClient.py b/LinksAwakeningClient.py index cc968ad9adaf..a51645feac92 100644 --- a/LinksAwakeningClient.py +++ b/LinksAwakeningClient.py @@ -348,7 +348,8 @@ async def wait_for_retroarch_connection(self): await asyncio.sleep(1.0) continue self.stop_bizhawk_spam = False - logger.info(f"Connected to Retroarch {version.decode('ascii', errors='replace')} running {rom_name.decode('ascii', errors='replace')}") + logger.info(f"Connected to Retroarch {version.decode('ascii', errors='replace')} " + f"running {rom_name.decode('ascii', errors='replace')}") return except (BlockingIOError, TimeoutError, ConnectionResetError): await asyncio.sleep(1.0)