Allasso has asked for the wisdom of the Perl Monks concerning the following question:
Instead of only removing the first unicode point. I have been reading https://perldoc.perl.org/utf8.html and https://perldoc.perl.org/Encode.html, but can't seem to find a combination that works. I've tried:echo -n 'a…b' | perl -pe 's@(.).(.)@$1$2@';
The only thing I've found so far that works is this, but is deprecated :-/ (and I believe applies to the whole script):echo -n 'a…b' | perl -pe 'use utf8; s@(.).(.)@$1$2@'; echo -n 'a…b' | perl -pe 'utf8::encode($_); s@(.).(.)@$1$2@'; echo -n 'a…b' | perl -pe 'utf8::upgrade($_); s@(.).(.)@$1$2@'; echo -n 'a…b' | perl -pe 'use Encode qw(decode encode); $_ = encode("u +tf-8", $_); s@(.).(.)@$1$2@'; echo -n 'a…b' | perl -pe 'use Encode qw(decode encode); $_ = encode("u +tf8", $_); s@(.).(.)@$1$2@';
echo -n 'a…b' | perl -pe 'use encoding 'utf8', Filter => 1; s@(.).(.)@ +$1$2@';
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Match full utf-8 characters
by afoken (Chancellor) on Apr 29, 2019 at 12:51 UTC | |
by Allasso (Monk) on Apr 29, 2019 at 13:24 UTC | |
by Allasso (Monk) on Apr 29, 2019 at 13:36 UTC | |
by Anonymous Monk on Apr 29, 2019 at 13:55 UTC | |
by Allasso (Monk) on Apr 29, 2019 at 15:14 UTC | |
| |
|
Re: Match full utf-8 characters
by hippo (Archbishop) on Apr 29, 2019 at 12:51 UTC | |
by Allasso (Monk) on Apr 29, 2019 at 13:26 UTC | |
by hippo (Archbishop) on Apr 29, 2019 at 15:44 UTC | |
|
Re: Match full utf-8 characters
by hdb (Monsignor) on Apr 29, 2019 at 12:38 UTC | |
by Allasso (Monk) on Apr 29, 2019 at 13:40 UTC |