Skip to content

Commit

Permalink
Merge pull request #1803 from ikedas/issue-1802 by ikedas
Browse files Browse the repository at this point in the history
WWSympa: Uploaded file names in UTF-8 were garbled (#1802)
  • Loading branch information
ikedas authored Sep 1, 2024
2 parents 88da409 + 52734ee commit 5379b80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ recommends 'Net::SMTP';
# Note: Perl 5.10.1 bundles 1.03 (per Unicode 5.1.0).
recommends 'Unicode::Normalize', '>= 1.03';

recommends 'Unicode::UTF8', '>= 0.58';
recommends 'Unicode::UTF8', '>= 0.60';

### Features
##
Expand Down Expand Up @@ -327,7 +327,7 @@ feature 'safe-unicode', 'Sanitizes inputs with Unicode text.' => sub {
# Note: Perl 5.8.1 bundles version 0.23.
# Note: Perl 5.10.1 bundles 1.03 (per Unicode 5.1.0).
requires 'Unicode::Normalize', '>= 1.03';
requires 'Unicode::UTF8', '>= 0.58';
requires 'Unicode::UTF8', '>= 0.60';
};

on 'test' => sub {
Expand Down
6 changes: 4 additions & 2 deletions src/lib/Sympa/Tools/Text.pm
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,10 @@ sub guessed_to_utf8 {

my $utf8;
if ($Unicode::UTF8::VERSION) {
$utf8 =
eval { Unicode::UTF8::decode_utf8($text, Encode::FB_CROAK()) };
$utf8 = Unicode::UTF8::decode_utf8($text)
if Unicode::UTF8::valid_utf8($text);
} else {
$utf8 = eval { Encode::decode_utf8($text, Encode::FB_CROAK()) };
}
unless (defined $utf8) {
foreach my $charset (map { $_ ? @$_ : () } @legacy_charsets{@langs}) {
Expand Down

0 comments on commit 5379b80

Please sign in to comment.