- use Encode was missed out in the previous patch for dns.cgi This would mean that the decode from UTF-8 would fail. I had tested the previous change but forgot to copy across the use Encode line when I created the patch. - This patch adds an encode back to UTF-8 after running the cleanhtml command. This way the text is decoded from UTF-8 so that the cleanhtml command works correctly on umlauted characters and then is encoded back to UTF-8 so that all text in the cgi page is UTF-8.
Tested-by: Adolf Belka adolf.belka@ipfire.org Signed-off-by: Adolf Belka adolf.belka@ipfire.org --- html/cgi-bin/dns.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index eb6f908d5..c864c127d 100644 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2020 IPFire Development Team # +# Copyright (C) 2005-2024 IPFire Team info@ipfire.org # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -21,6 +21,7 @@
use strict; use IO::Socket; +use Encode;
# enable only the following on debugging purpose #use warnings; @@ -151,6 +152,9 @@ if (($cgiparams{'SERVERS'} eq $Lang::tr{'save'}) || ($cgiparams{'SERVERS'} eq $L # are correctly encoded to their html entities $cgiparams{'REMARK'} = &Header::cleanhtml($cgiparams{'REMARK'});
+ # encode the text back to UTF-8 after running the cleanhtml command + $cgiparams{'REMARK'} = encode("UTF-8", $cgiparams{'REMARK'}); + my %dns_servers = (); my $id; my $status;
Hi Michael,
I saw that this patch had been merged but then saw that you had added a patch to remove extraneous whitespace. I thought at first that I had added a blank line also to the dns.cgi file. Then looked at the patch and at first did not understand it because it looked like it had deleted a line and then added it back in.
Eventually figured it out :-) My editor had automatic indentation turned on and so it added in the tabs to get to the start of the previous line. I found that on some lines and removed it but missed it on that last line.
I have now turned off the automatic indentation so that a blank line will in fact stay blank with no spaces.
Sorry about that.
Regards, Adolf.
On 13/03/2024 23:12, Adolf Belka wrote:
- use Encode was missed out in the previous patch for dns.cgi This would mean that the decode from UTF-8 would fail. I had tested the previous change but forgot to copy across the use Encode line when I created the patch.
- This patch adds an encode back to UTF-8 after running the cleanhtml command. This way the text is decoded from UTF-8 so that the cleanhtml command works correctly on umlauted characters and then is encoded back to UTF-8 so that all text in the cgi page is UTF-8.
Tested-by: Adolf Belka adolf.belka@ipfire.org Signed-off-by: Adolf Belka adolf.belka@ipfire.org
html/cgi-bin/dns.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index eb6f908d5..c864c127d 100644 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2020 IPFire Development Team # +# Copyright (C) 2005-2024 IPFire Team info@ipfire.org # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -21,6 +21,7 @@
use strict; use IO::Socket; +use Encode;
# enable only the following on debugging purpose #use warnings; @@ -151,6 +152,9 @@ if (($cgiparams{'SERVERS'} eq $Lang::tr{'save'}) || ($cgiparams{'SERVERS'} eq $L # are correctly encoded to their html entities $cgiparams{'REMARK'} = &Header::cleanhtml($cgiparams{'REMARK'});
# encode the text back to UTF-8 after running the cleanhtml command
$cgiparams{'REMARK'} = encode("UTF-8", $cgiparams{'REMARK'});
- my %dns_servers = (); my $id; my $status;
Hello Adolf,
Yes, editors sometimes have odd default settings. I don’t know why, because I never feel like they would be the right thing for anyone.
However, we generally don’t want lines with just whitespace. We just want an empty line. “git show” shows any whitespace like that in bright red and when you apply a patch it shows a warning.
I am not sure if we need to write down some guidelines anywhere for this though. Everyone’s editor is different anyways.
-Michael
On 14 Mar 2024, at 11:13, Adolf Belka adolf.belka@ipfire.org wrote:
Hi Michael,
I saw that this patch had been merged but then saw that you had added a patch to remove extraneous whitespace. I thought at first that I had added a blank line also to the dns.cgi file. Then looked at the patch and at first did not understand it because it looked like it had deleted a line and then added it back in.
Eventually figured it out :-) My editor had automatic indentation turned on and so it added in the tabs to get to the start of the previous line. I found that on some lines and removed it but missed it on that last line.
I have now turned off the automatic indentation so that a blank line will in fact stay blank with no spaces.
Sorry about that.
Regards, Adolf.
On 13/03/2024 23:12, Adolf Belka wrote:
- use Encode was missed out in the previous patch for dns.cgi This would mean that the decode from UTF-8 would fail. I had tested the previous change but forgot to copy across the use Encode line when I created the patch.
- This patch adds an encode back to UTF-8 after running the cleanhtml command. This way the text is decoded from UTF-8 so that the cleanhtml command works correctly on umlauted characters and then is encoded back to UTF-8 so that all text in the cgi page is UTF-8.
Tested-by: Adolf Belka adolf.belka@ipfire.org Signed-off-by: Adolf Belka adolf.belka@ipfire.org
html/cgi-bin/dns.cgi | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index eb6f908d5..c864c127d 100644 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2020 IPFire Development Team # +# Copyright (C) 2005-2024 IPFire Team info@ipfire.org # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -21,6 +21,7 @@ use strict; use IO::Socket; +use Encode; # enable only the following on debugging purpose #use warnings; @@ -151,6 +152,9 @@ if (($cgiparams{'SERVERS'} eq $Lang::tr{'save'}) || ($cgiparams{'SERVERS'} eq $L # are correctly encoded to their html entities $cgiparams{'REMARK'} = &Header::cleanhtml($cgiparams{'REMARK'});
- # encode the text back to UTF-8 after running the cleanhtml command
- $cgiparams{'REMARK'} = encode("UTF-8", $cgiparams{'REMARK'});
- my %dns_servers = (); my $id; my $status;