From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NO_DNS_FOR_FROM,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from localhost.localdomain (unknown [101.128.125.123]) by gnuweeb.org (Postfix) with ESMTPSA id A4B6C811DF; Thu, 20 Oct 2022 08:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gnuweeb.org; s=default; t=1666255150; bh=mfYvgSnO/3vh6V4X0aCSzkrPpea0l0iBlTO0uIXCyMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CseQPymL4LS0hoY37KH/+1iYzveEePwmSSSDjow3OmPzBwBciHcIay54WJDXHBxxH D6qWFep33AXsUjrCgvVizppxM6DOekLCCL5JIlev0zTzwHpeo1sZ+St8701b6NQ/yR 7OLjo4syC42AP8LsrfuDdFFNyAUHtfBJbCKly26JT6FBWuNwEORJiB9W19/VA3oUdk ObRYrTFHY0IP43wUqMLvuUXwgCBfv6PUwm4ku7UOKE2rpvWo7FyCbE871BA3mtnNxr 9DMECzXauykb89dp22Ppnd7lwO1zzI39WcAt3xrIhfJ7onLnsQYcszRjTry3EWGjN0 97kztzI7hdYQw== From: Muhammad Rizki To: Ammar Faizi Cc: Muhammad Rizki , Alviro Iskandar Setiawan , GNU/Weeb Mailing List Subject: [PATCH v2 4/8] atom: Small change for fix_utf8_char() Date: Thu, 20 Oct 2022 15:38:41 +0700 Message-Id: <20221020083845.907-5-kiizuha@gnuweeb.org> X-Mailer: git-send-email 2.34.1.windows.1 In-Reply-To: <20221020083845.907-1-kiizuha@gnuweeb.org> References: <20221020083845.907-1-kiizuha@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: Change the parameter to unescape with boolean type and change from html.escape to html.unescape for the Discord bot. Signed-off-by: Muhammad Rizki --- daemon/atom/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon/atom/utils.py b/daemon/atom/utils.py index a30d5cb..c95612e 100644 --- a/daemon/atom/utils.py +++ b/daemon/atom/utils.py @@ -206,7 +206,7 @@ def create_template(thread: Message, platform: str, to=None, cc=None): if len(ret) >= substr: ret = ret[:substr] + "..." - ret = fix_utf8_char(ret, platform == "telegram") + ret = fix_utf8_char(ret, platform == "discord") ret += border return ret, files, is_patch @@ -242,10 +242,10 @@ def remove_patch(tmp): shutil.rmtree(tmp) -def fix_utf8_char(text: str, html_escape: bool = True): +def fix_utf8_char(text: str, unescape: bool = True): t = text.rstrip().replace("�"," ") - if html_escape: - t = html.escape(html.escape(text)) + if unescape: + t = html.unescape(html.unescape(text)) return t -- Muhammad Rizki