use strict;
use warnings;
use Test::More tests => 5;
my $spacestr = "a\N{ZERO WIDTH SPACE}b";
isnt $spacestr, 'ab', 'String differs from plain "ab"';
is length ($spacestr), 3, 'Length is 3';
is substr ($spacestr, 1, 1), "\x{200B}", 'Middle char is U+200B';
like $spacestr, qr/\p{Lb=ZW}/, '\p{Lb=ZW} matches U+200B';
$spacestr =~ s/\p{Lb=ZW}//;
is $spacestr, 'ab', 'After stripping, string is plain "ab"';
This is not to say that this is a good solution to phildeman's problem, of course. Far better just to get the decoding/encoding correct in the first place.
|