CheckUTF8(3)

πŸ“¦
version 1.03 Β· 4 versions
, in epel 9

🌸 NAME 🌸

So bestie, you know what this is? It's Unicode::CheckUTF8 β€” literally the vibe check for your scalars, checking if they're valid UTF-8. Periodt. πŸ’…

This page is coming at you from the User Contributed Perl Documentation corner of the universe, and it's about to be your new fave. 🫢


✨ SYNOPSIS ✨

Okay so here's the whole entire mood:

use Unicode::CheckUTF8 qw(is_utf8);
my $is_ok = is_utf8($scalar);

That's it. That's the whole slay. You import is_utf8, you feed it a scalar, it tells you if it's valid. Iconic behavior, no cap. πŸŽ€


πŸ’– DESCRIPTION πŸ’–

Alright bestie, let me put you on. This module is an XS wrapper around some Unicode Consortium code β€” you know, the official Unicode people, the main characters of text encoding β€” and what it does is check if a string is valid UTF-8. πŸ¦‹

But wait, there's more! It's been revised to conform to what expat/Mozilla think is valid UTF-8 β€” especially when it comes to low-ASCII characters. So it's not just regular valid, it's their kind of valid. It's giving ✨collaboration✨.

Not me needing to say this, but: this module has NOTHING to do with Perl's internal UTF8 flag on scalars. Like, zero. Zilch. Nada. Please don't confuse them, I'm begging. 😭

So when do you use this? Literally whenever you're getting input from users and you want to make sure it's valid UTF-8 before you keep going. You know how users are β€” they'll send you the wildest byte sequences and just expect you to deal. This module is your bouncer. It checks IDs at the door. πŸšͺπŸ’…


πŸŽ€ HISTORY πŸŽ€

Okay so storytime, gather 'round. πŸ•―οΈ

This is some old code, bestie. Like, dating back to before Perl 5.8 and before Unicode support even existed in Perl. We're talking ancient. Y2K-era ancient. The way this code has seen things. πŸ‘‘

And the author is like, "I wish I didn't have to keep using this code" β€” honestly same energy as me still using the same password since 2016 😭 β€” but they literally 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. The C in CPAN stands for "Can't Please Anyone" and this module is living proof. πŸ’€


πŸ’€ BUGS πŸ’€

Hopefully not, but mail me if so! πŸ“§

That's it. That's the whole bugs section. The confidence. The audacity. The main character energy. We love a humble king who assumes his code is flawless. πŸ”₯


πŸ‘‘ AUTHOR πŸ‘‘

Let's give credit where credit is due, besties! 🌈

  • Brad Fitzpatrick <brad@danga.com> β€” based on Unicode Consortium code. The OG. The architect. The one who said "fine, I'll do it myself." ⭐
  • Artur Bergman β€” helped kill old Inline code using his awesome knowledge of all things Perl and XS. We stan a collaborative king. 🧚

And that's the whole page, babes! πŸ’œ

This masterpiece of documentation was brought to you by perl v5.32.1 on 2019-10-29 β€” so if you're reading this, just know that the vibes are timeless and the UTF-8 checking is eternal. Slay! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ˜­πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ

πŸ“¦ where this page comes from