From: Junio C Hamano <gitster@pobox.com>
To: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
Cc: git@vger.kernel.org, ben.knoble@gmail.com, philipoakley@iee.email
Subject: Re: [PATCH v2] send-email: validate charset name in 8bit encoding prompt
Date: Tue, 24 Feb 2026 14:06:06 -0800 [thread overview]
Message-ID: <xmqqqzq9er01.fsf@gitster.g> (raw)
In-Reply-To: <20260224213932.92364-1-shreyanshpaliwalcmsmn@gmail.com> (Shreyansh Paliwal's message of "Wed, 25 Feb 2026 03:07:39 +0530")
Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com> writes:
> When a non-ASCII character is detected in the body or subject of the email
> the user is prompted with,
>
> Which 8bit encoding should I declare [UTF-8]? foo
>
> After this the input string is validated by the regex, based on the fact
> that the charset string will be minimum 4 characters [1]. If the string is
> more than 4 letters the email is sent, if not then a second prompt to
> confirm is asked to the user,
>
> Are you sure you want to use <foo> [y/N]? y
>
> This relies on a length based regex heuristic check to validate the user
> input, and can allow clearly invalid charset names to pass if the input is
> greater than 4 characters.
>
> Add a semantic validation of the charset name using the
> Encode::find_encoding() module of perl. If the encoding is not recognized,
> warn the user and ask for confirmation before proceeding. After this
> validation the lenght based validation becomes redundant and also breaks
> flow, so change the regex of valid input to any non blank string.
>
> Additionally, the wording of the first prompt can confuse the user if not
> read properly or under any default assumptions for a yes/no prompt. Change
> the wording to make it explicitly clear to the user that the prompt needs a
> string input, UTF-8 being the default.
>
> The intended flow is,
>
> Declare which 8bit encoding to use [default: UTF-8]? foobar
> warning: 'foobar' does not appear to be a valid charset name.
> Are you sure you want to use <foobar> [y/N]?
>
> [1]- https://github.com/git/git/commit/852a15d748034eec87adbee73a72689c8936fb8b
>
> Signed-off-by: Shreyansh Paliwal <shreyanshpaliwalcmsmn@gmail.com>
> ---
> Changes in v2:
> - Added braces in if-else block.
>
> git-send-email.perl | 17 ++++++++++++++---
> t/t9001-send-email.sh | 2 +-
> 2 files changed, 15 insertions(+), 4 deletions(-)
Curious. This change to t9001 was there even in the previous
iteration that did not even work. How did you test it?
Will replace.
next prev parent reply other threads:[~2026-02-24 22:06 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 14:50 [RFC] send-email: UTF-8 encoding in subject line Shreyansh Paliwal
2026-02-21 2:28 ` Ben Knoble
2026-02-21 13:38 ` Shreyansh Paliwal
2026-02-21 17:30 ` Junio C Hamano
2026-02-22 14:03 ` Shreyansh Paliwal
2026-02-22 14:53 ` Philip Oakley
2026-02-22 15:00 ` D. Ben Knoble
2026-02-22 15:52 ` Shreyansh Paliwal
2026-02-23 21:38 ` Ben Knoble
2026-02-24 7:55 ` [GSOC] Discuss: Refactoring in order to reduce global state Shreyansh Paliwal
2026-02-22 14:53 ` [RFC] send-email: UTF-8 encoding in subject line D. Ben Knoble
2026-02-24 14:33 ` [PATCH] send-email: validate charset name in 8bit encoding prompt Shreyansh Paliwal
2026-02-24 21:11 ` Junio C Hamano
2026-02-24 21:37 ` [PATCH v2] " Shreyansh Paliwal
2026-02-24 22:06 ` Junio C Hamano [this message]
2026-02-24 22:20 ` Shreyansh Paliwal
2026-02-25 16:37 ` D. Ben Knoble
2026-02-26 17:32 ` Shreyansh Paliwal
2026-02-26 16:16 ` [PATCH v3] " Shreyansh Paliwal
2026-02-26 18:45 ` Junio C Hamano
2026-02-26 19:06 ` Junio C Hamano
2026-02-28 8:41 ` Shreyansh Paliwal
2026-02-28 8:36 ` Shreyansh Paliwal
2026-02-28 11:20 ` [PATCH v4] " Shreyansh Paliwal
2026-02-28 21:16 ` D. Ben Knoble
2026-03-02 16:10 ` Junio C Hamano
2026-03-03 19:06 ` Shreyansh Paliwal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqqzq9er01.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=philipoakley@iee.email \
--cc=shreyanshpaliwalcmsmn@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox