From 5de771224a3059eb8e6744f74c9893d81910bdc4 Mon Sep 17 00:00:00 2001 From: starflowerbracken Date: Wed, 29 Sep 2021 12:44:03 +0100 Subject: [PATCH] Update SearchEvents.pl Remove four-byte UTF-8 BMP characters that MySQL won't like. The best way was to simply remove them by regex. --- SearchEvents.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SearchEvents.pl b/SearchEvents.pl index 2d2c6ef..bddb8d9 100644 --- a/SearchEvents.pl +++ b/SearchEvents.pl @@ -60,6 +60,9 @@ $description =~ s/\xA0/ /g; $description =~ s/ / /g; $description =~ s/ / /g; + # the next two lines remove four-byte UTF-8 characters that MySQL won't like + my $not_bmp = qr([\x{10000}-\x{10FFFF}]); + $description =~ s/$not_bmp//g; use HTML::Strip; @@ -77,6 +80,8 @@ $name =~ s/\xA0/ /g; $name =~ s/ / /g; $name =~ s/ / /g; + # the next line removes four-byte UTF-8 characters that MySQL won't like (see above) + $name =~ s/$not_bmp//g; # had to comment these out as another source of problem characters #utf8::decode($name);