From patchwork Mon Mar 11 12:19:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Adolf Belka X-Patchwork-Id: 7600 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TtbRw68m8z3wtq for ; Mon, 11 Mar 2024 12:19:24 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TtbRs1h8vz1C7; Mon, 11 Mar 2024 12:19:21 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TtbRs1CmZz32MW; Mon, 11 Mar 2024 12:19:21 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TtbRn2mbqz304Y for ; Mon, 11 Mar 2024 12:19:17 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4TtbRn0kvczs6; Mon, 11 Mar 2024 12:19:17 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1710159557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TgmcHlln5lCJjh+AFqTpaT7mtKm9dk0OoJAROOuHf4=; b=hmCgjwjPMe0qIWBZwiggDBol1K/LiqoyINTXZtwuOO4lcp1ovoGbu9zl1OKHaXUH2mTaQ1 Q1RzcrnnXQBzebDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1710159557; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9TgmcHlln5lCJjh+AFqTpaT7mtKm9dk0OoJAROOuHf4=; b=fo6kHkA62ohsdq1s4aWlawISa3upRa4u7MW+BFNaV2dkBBGLsXQ7Rdaw3aeGzUehhvE2ZG 33P0BItFtqFEE/xKbmEWy+v+F+Nv1F5bT+M5MBoFXwIDG8g8wghR/UUCkIjozVqu9wnZRn ShwISpsynCVtYSnTX0T6VPiY4UIOCTJuurUftLhaKNIZ5Gpj39RIxGvGBb57+I7vO+beAc 5jcjepndRwvq96zqultXdrPHM0LFrodMgMWVFZcukiscu37hxHBCBWTsr1DuQTXnQ/4au7 C2VzhuYo4nElTYGArYqdZMgragB0O2RrAbH29OYlbsvcziwfVhoFWxs0bBKLMw== From: Adolf Belka To: development@lists.ipfire.org Subject: [PATCH v2 2/2] dns.cgi: Fixes bug#12395 - German umlauts not correctly displayed in remarks Date: Mon, 11 Mar 2024 13:19:09 +0100 Message-ID: <20240311121909.5445-2-adolf.belka@ipfire.org> In-Reply-To: <20240311121909.5445-1-adolf.belka@ipfire.org> References: <20240311121909.5445-1-adolf.belka@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: EVSRRLX74AEWZMK2KCA32S3UID3XYHR2 X-Message-ID-Hash: EVSRRLX74AEWZMK2KCA32S3UID3XYHR2 X-MailFrom: adolf.belka@ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: - If Freifunk München e.V. is entered as a remark it gets converted to Freifunk München e.V. - This is because cleanhtml is used on the UTF-8 remark text before saving it to the file and the HTML::Entities::encode_entities command that is run on that remark text does not work with UTF-8 text. - If the UTF-8 text in the remark is decoded before running through the cleanhtml command then the characters with diacritical marks are correctly shown. - Have tested out the fix on a remark with a range of different characters with diacritical marks and all of the ones tested were displayed correctly with the fix while in the original form they were mangled. Fixes: Bug#12395 Tested-by: Adolf Belka Signed-off-by: Adolf Belka --- html/cgi-bin/dns.cgi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index 0a34d3fd6..eb6f908d5 100644 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -142,6 +142,13 @@ if (($cgiparams{'SERVERS'} eq $Lang::tr{'save'}) || ($cgiparams{'SERVERS'} eq $L # Go further if there was no error. if ( ! $errormessage) { # Check if a remark has been entered. + + # decode the UTF-8 text so that characters with diacritical marks such as + # umlauts are treated correctly by the following cleanhtml command + $cgiparams{'REMARK'} = decode("UTF-8", $cgiparams{'REMARK'}); + + # run the REMARK text through cleanhtml to ensure all unsafe html characters + # are correctly encoded to their html entities $cgiparams{'REMARK'} = &Header::cleanhtml($cgiparams{'REMARK'}); my %dns_servers = ();