Subject: Re: [PATCH] send-email: validate charset name in 8bit encoding prompt

From: Junio C Hamano <[email-masked]>
Date: Tue, 24 Feb 2026 13:11:04 -0800

Shreyansh Paliwal <[email-masked]> writes:

> +			if ($warn_invalid) {
> +				if (find_encoding($resp))
> +					return $resp;
> +				else
> +					printf STDERR __("warning: '%s' does not appear to be a valid charset name.\n"), $resp;
> +			} else
> +				return $resp;

This is not C but Perl.

 git-send-email.perl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git i/git-send-email.perl w/git-send-email.perl
index dc4e5418d3..15387ac377 100755
--- i/git-send-email.perl
+++ w/git-send-email.perl
@@ -1008,12 +1008,14 @@ sub ask {
 		}
 		if (!defined $valid_re or $resp =~ /$valid_re/) {
 			if ($warn_invalid) {
-				if (find_encoding($resp))
+				if (find_encoding($resp)) {
 					return $resp;
-				else
+				} else {
 					printf STDERR __("warning: '%s' does not appear to be a valid charset name.\n"), $resp;
-			} else
+				}
+			} else {
 				return $resp;
+			}
 		}
 		if ($confirm_only) {
 			my $yesno = $term->readline(