Bug 14759: Replace Text::Unaccent with Unicode::Normalize
As shown in the comments on the bug, it appears that Unicode::Normalize is the most reliable way to strip accents from strings for this use case. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Joy Nelson <joy@bywatersolutions.com> (cherry picked from commit27de0d6179) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> (cherry picked from commit708fd8b4b1) Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz>
This commit is contained in:
parent
70d1f0a1ba
commit
3f4c326bf7
|
|
@ -617,11 +617,6 @@ our $PERL_DEPS = {
|
|||
required => 0,
|
||||
min_ver => '0.40'
|
||||
},
|
||||
'Text::Unaccent' => {
|
||||
'usage' => 'Core',
|
||||
'required' => '1',
|
||||
'min_ver' => '1.08',
|
||||
},
|
||||
'Test::WWW::Mechanize' => {
|
||||
'usage' => 'Testing suite',
|
||||
'required' => '0',
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use Modern::Perl;
|
|||
use Carp;
|
||||
use List::MoreUtils qw( uniq );
|
||||
use JSON qw( to_json );
|
||||
use Text::Unaccent qw( unac_string );
|
||||
use Unicode::Normalize;
|
||||
|
||||
use C4::Accounts;
|
||||
use C4::Context;
|
||||
|
|
@ -1293,14 +1293,14 @@ sub generate_userid {
|
|||
$firstname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
|
||||
$surname =~ s/[[:digit:][:space:][:blank:][:punct:][:cntrl:]]//g;
|
||||
my $userid = lc(($firstname)? "$firstname.$surname" : $surname);
|
||||
$userid = unac_string('utf-8',$userid);
|
||||
$userid = NFKD( $userid );
|
||||
$userid =~ s/\p{NonspacingMark}//g;
|
||||
$userid .= $offset unless $offset == 0;
|
||||
$self->userid( $userid );
|
||||
$offset++;
|
||||
} while (! $self->has_valid_userid );
|
||||
|
||||
return $self;
|
||||
|
||||
}
|
||||
|
||||
=head2 Internal methods
|
||||
|
|
|
|||
Loading…
Reference in New Issue