Encode:...odedUTF8(3)
π NAME π
Encode::DoubleEncodedUTF8 β ok so bestie, this is the manual page for Encode::DoubleEncodedUTF8(3), and what it does is fix double encoded UTF-8 bytes to the correct one β¨
Like, those cursed bytes that got encoded twice and are now giving chaos? Yeah. We un-chaos them. π
π SYNOPSIS π
use Encode;
use Encode::DoubleEncodedUTF8;
my $dodgy_utf8 = "Some byte strings from the web/DB with double-encoded UTF-8 bytes";
my $fixed = decode("utf-8-de", $dodgy_utf8); # Fix it
That's it. That's the whole vibe. π«Ά
π WARNINGS π
Use this module only for testing, debugging, data recovery and working around with buggy software you can't fix.
Do not use this module in your production code just to work around bugs in the code you can fix. Not the move. Periodt.
This module is slow, and not perfect, and it may break the encodings if you run against correctly encoded strings. See perlunitut for more details.
β¨ DESCRIPTION β¨
Encode::DoubleEncodedUTF8 adds a new encoding, utf-8-de, and it fixes double encoded utf-8 bytes found in the original bytes to the correct Unicode entity. Iconic behaviour honestly. π
The double encoded utf-8 frequently happens when strings with UTF-8 flag and without are concatenated, for instance:
my $string = "L\x{e9}on"; # latin-1
utf8::upgrade($string);
my $bytes = "L\xc3\xa9on"; # utf-8
my $dodgy_utf8 = encode_utf8($string . " " . $bytes); # $bytes is now double encoded
my $fixed = decode("utf-8-de", $dodgy_utf8); # "L\x{e9}on L\x{e9}on";
See encoding::warnings for more details. π¦
πΈ AUTHOR πΈ
Tatsuhiko Miyagawa <miyagawa@bulknews.net> β the original author, absolute legend, we stan π«Ά
π§ LICENSE π§
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
β SEE ALSO β
encoding::warningsTest::utf8
okay bye bestie π this page is from perl v5.42.0, dated 2025-07-25, and yeah the manual title is Encode:...odedUTF8(3) because someone let the pod formatter pick the name and it ate the middle. slay. π
β¨π
π¦ where this page comes from
- fedora 43: perl-Encode-DoubleEncodedUTF8 0.05-34.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms