20 Dec 2010 21:12:23 UTC
- Distribution: Unicode-CheckUTF8
- Module version: 1.03
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (3212 / 0 / 0)
- KwaliteeBus factor: 0
- 100.00% Coverage
- License: unknown
- Activity24 month
- Download (24.89KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Unicode::CheckUTF8 - checks if scalar is valid UTF-8
use Unicode::CheckUTF8 qw(is_utf8); my $is_ok = is_utf8($scalar);
This is an XS wrapper around some Unicode Consortium code to check if a string is valid UTF-8, revised to conform to what expat/Mozilla think is valid UTF-8, especially with regard to low-ASCII characters.
Note that this module has NOTHING to do with Perl's internal UTF8 flag on scalars.
This module is for use when you're getting input from users and want to make sure it's valid UTF-8 before continuing.
This is some old code, dating back to before Perl 5.8 and before Unicode support in Perl. I wish I didn't have to keep using this code, but I can't find any other code on CPAN for UTF-8 checking that's both sufficiently fast and more importantly, correct. So now there's yet another way to do it.
Hopefully not, but mail me if so!
Brad Fitzpatrick <email@example.com>, based on Unicode Consortium code.
Artur Bergman, helping me kill old Inline code using his awesome knowledge of all things Perl and XS.
Module Install Instructions
To install Unicode::CheckUTF8, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Unicode::CheckUTF8
For more information on module installation, please visit the detailed CPAN module installation guide.