From 936e17338c3b172b7df5f6a47bc22dfd0869dcbd Mon Sep 17 00:00:00 2001 From: Jakub Kuczys Date: Mon, 25 Aug 2025 23:43:41 +0200 Subject: [PATCH] Fix unhandled exception in stringification of DevOutput's result (#6592) --- redbot/core/dev_commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/redbot/core/dev_commands.py b/redbot/core/dev_commands.py index b0deb5c58..d0e400f2c 100644 --- a/redbot/core/dev_commands.py +++ b/redbot/core/dev_commands.py @@ -158,9 +158,13 @@ class DevOutput: output.append(self.formatted_exc) elif self.always_include_result or self.result is not None: try: - output.append(str(self.result)) + result = str(self.result) + # ensure that the result can be encoded (GH-6485) + result.encode("utf-8") except Exception as exc: output.append(self.format_exception(exc)) + else: + output.append(result) return sanitize_output(self.ctx, "".join(output)) async def send(self, *, tick: bool = True) -> None: