Skip to content

Commit

Permalink
Add hdiacritic to driver
Browse files Browse the repository at this point in the history
  • Loading branch information
johannaraisa committed Sep 2, 2021
1 parent 62eb132 commit 01060bb
Showing 1 changed file with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package SMS::Send::LinkMobility::Driver;
#use Modern::Perl; #Can't use this since SMS::Send uses hash keys starting with _
use SMS::Send::Driver ();
use LWP::Curl;
use LWP::UserAgent;
use URI::Escape;
use C4::Context;
use Encode;
use Unicode::Normalize;
use Koha::Notice::Messages;

use Try::Tiny;

Expand Down Expand Up @@ -59,6 +60,31 @@ sub new {
return $self;
}

sub hdiacritic {
my $char;
my $oldchar;
my $retstring;

foreach (split(//, $_[0])) {
$char=$_;
$oldchar=$char;

unless ( $char =~/[A-Za-z0-9ÅåÄäÖöÉéÈèÌìÍíÓóÒòÔôÎîÇçÆæÏïÜüÐðØøÞþßÕõÑñÛûÂâÊêËëÃãÝýÀàÁáÂâÚúÙùÿ]/ ) {

$char='Z' if $char eq 'Ʒ';
$char='z' if $char eq 'ʒ';
$char='Ð' if $char eq 'Ɖ';
$char='Ð' if $char eq 'Đ'; # This is not the same as above, so don't remove either one!
$char='\'' if $char eq 'ʻ';

$char=NFKD($char) if "$oldchar" eq "$char";
}
$retstring=$retstring . $char;
}

return $retstring;
}

sub send_sms {
my $self = shift;
my $params = {@_};
Expand Down

0 comments on commit 01060bb

Please sign in to comment.