aboutsummaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl25
1 files changed, 22 insertions, 3 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index cd4b316ddc..3186104709 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -23,6 +23,7 @@ use Getopt::Long;
use Git::LoadCPAN::Error qw(:try);
use Git;
use Git::I18N;
+use Encode qw(find_encoding);
Getopt::Long::Configure qw/ pass_through /;
@@ -1044,9 +1045,27 @@ if (!defined $auto_8bit_encoding && scalar %broken_encoding) {
foreach my $f (sort keys %broken_encoding) {
print " $f\n";
}
- $auto_8bit_encoding = ask(__("Which 8bit encoding should I declare [UTF-8]? "),
- valid_re => qr/.{4}/, confirm_only => 1,
- default => "UTF-8");
+ while (1) {
+ my $encoding = ask(
+ __("Declare which 8bit encoding to use [default: UTF-8]? "),
+ valid_re => qr/^\S+$/,
+ default => "UTF-8");
+ next unless defined $encoding;
+ if (find_encoding($encoding)) {
+ $auto_8bit_encoding = $encoding;
+ last;
+ }
+ my $yesno = ask(
+ sprintf(
+ __("'%s' does not appear to be a valid charset name. Use it anyway [y/N]? "),
+ $encoding),
+ valid_re => qr/^(?:y|n)/i,
+ default => "n");
+ if (defined $yesno && $yesno =~ /^y/i) {
+ $auto_8bit_encoding = $encoding;
+ last;
+ }
+ }
}
if (!$force) {