1CheckUTF8(3) User Contributed Perl Documentation CheckUTF8(3)
2
3
4
6 Unicode::CheckUTF8 - checks if scalar is valid UTF-8
7
9 use Unicode::CheckUTF8 qw(is_utf8);
10 my $is_ok = is_utf8($scalar);
11
13 This is an XS wrapper around some Unicode Consortium code to check if a
14 string is valid UTF-8, revised to conform to what expat/Mozilla think
15 is valid UTF-8, especially with regard to low-ASCII characters.
16
17 Note that this module has NOTHING to do with Perl's internal UTF8 flag
18 on scalars.
19
20 This module is for use when you're getting input from users and want to
21 make sure it's valid UTF-8 before continuing.
22
24 This is some old code, dating back to before Perl 5.8 and before
25 Unicode support in Perl. I wish I didn't have to keep using this code,
26 but I can't find any other code on CPAN for UTF-8 checking that's both
27 sufficiently fast and more importantly, correct. So now there's yet
28 another way to do it.
29
31 Hopefully not, but mail me if so!
32
34 Brad Fitzpatrick <brad@danga.com>, based on Unicode Consortium code.
35
36 Artur Bergman, helping me kill old Inline code using his awesome
37 knowledge of all things Perl and XS.
38
39
40
41perl v5.30.1 2020-01-30 CheckUTF8(3)