There are number of ways to deal with "Wide character" warnings; I'd generally use the open pragma.
Simulate warning
Code:
$ cat reproduce_wide_char_warn.t
#!perl
use strict;
use warnings;
use utf8;
use Test::More tests => 1;
is "🐪" =~ /\N{DROMEDARY CAMEL}/, 1,
'Test: "🐪" =~ /\N{DROMEDARY CAMEL}/';
Output:
$ prove -v reproduce_wide_char_warn.t
reproduce_wide_char_warn.t ..
1..1
ok 1 - Test: "🐪" =~ /\N{DROMEDARY CAMEL}/
Wide character in print at /home/ken/perl5/perlbrew/perls/perl-5.39.3/lib/5.39.3/Test2/Formatter/TAP.pm line 156.
ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.03 sys + 0.08 cusr 0.08 csys = 0.20 CPU)
Result: PASS
Resolve warning
Code:
$ cat fix_wide_char_warn.t
#!perl
use strict;
use warnings;
use utf8;
use open OUT => qw{:encoding(UTF-8) :std};
use Test::More tests => 1;
is "🐪" =~ /\N{DROMEDARY CAMEL}/, 1,
'Test: "🐪" =~ /\N{DROMEDARY CAMEL}/';
Output:
$ prove -v fix_wide_char_warn.t
fix_wide_char_warn.t ..
1..1
ok 1 - Test: "🐪" =~ /\N{DROMEDARY CAMEL}/
ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.02 usr 0.03 sys + 0.08 cusr 0.09 csys = 0.22 CPU)
Result: PASS
I'm not familiar with the Thai script, so I don't think I can help you much there. I did notice that some characters are very similar (e.g. ข & ฃ); so look closely at that sort of thing. I'm also aware that in some Unicode scripts the glyph changes depending on context (e.g. initial/start of word, medial/middle of word, final/end of word, isolate/by itself); so that's maybe something to investigate.
— Ken
In reply to Re^2: Listing out the characters included in a character class [wide character warning]
by kcott
in thread Listing out the characters included in a character class
by Polyglot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |