[Koha-bugs] [Bug 28870] Cart shipping fails because of Non-ASCII characters in display-name of reply-to address
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Aug 20 23:06:18 CEST 2021
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28870
--- Comment #4 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Ok, I've been playing with this. My conclusion is that Jonathan is right:
Email::Valid is buggy. I've learnt that regexps for validating RFC2822
addresses are not trivial [1]
The author/maintainer of the libraries we use, also maintains the
Email::Address library, that provides such regular expressions. My tests (on
Debian Buster) verify that Email::Address is able to handle UTF-8 characters
correctly.
I can submit a patch that replaces one library with the other (will probably do
it anyway) but I have doubts about the importance of validating email addresses
here. It feels like overkill.
[1] https://metacpan.org/pod/Email::Address#Package-Variables
The script I used for testing:
#!/usr/bin/perl
use Modern::Perl;
use utf8;
use Email::Address;
use Email::Valid;
binmode STDOUT, ':encoding(UTF-8)';
binmode STDERR, ':encoding(UTF-8)';
my $string = 'Tomás Cohen Arazi <tomascohen at theke.io>';
my ($email) = Email::Address->parse($string);
## This construct could be used instead of manually crafting
## the address in the $string format above. Same results
# my $email = Email::Address->new(
# 'Tomás Cohen Arazi' => 'tomacohe at theke.io'
# );
print "Testing address: $email\n";
say "Email::Address tests =>";
if ( "$email" =~ m/$Email::Address::mailbox/ ) {
say "Yay!";
}
else {
say "Boo!";
}
say "Email::Valid tests =>";
if (Email::Valid->address( -address => "$email", -fqdn => 0 )) {
say "Yay!";
}
else {
say "Boo!";
}
1;
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list