1Encode::DoubleEncodedUTUFs8e(r3)Contributed Perl DocumenEtnactoidoen::DoubleEncodedUTF8(3)
2
3
4

NAME

6       Encode::DoubleEncodedUTF8 - Fix double encoded UTF-8 bytes to the
7       correct one
8

SYNOPSIS

10         use Encode;
11         use Encode::DoubleEncodedUTF8;
12
13         my $dodgy_utf8 = "Some byte strings from the web/DB with double-encoded UTF-8 bytes";
14         my $fixed = decode("utf-8-de", $dodgy_utf8); # Fix it
15

WARNINGS

17       Use this module only for testing, debugging, data recovery and working
18       around with buggy software you can't fix.
19
20       Do not use this module in your production code just to work around bugs
21       in the code you can fix. This module is slow, and not perfect and may
22       break the encodings if you run against correctly encoded strings. See
23       perlunitut for more details.
24

DESCRIPTION

26       Encode::DoubleEncodedUTF8 adds a new encoding "utf-8-de" and fixes
27       double encoded utf-8 bytes found in the original bytes to the correct
28       Unicode entity.
29
30       The double encoded utf-8 frequently happens when strings with UTF-8
31       flag and without are concatenated, for instance:
32
33         my $string = "L\x{e9}on";   # latin-1
34         utf8::upgrade($string);
35         my $bytes  = "L\xc3\xa9on"; # utf-8
36
37         my $dodgy_utf8 = encode_utf8($string . " " . $bytes); # $bytes is now double encoded
38
39         my $fixed = decode("utf-8-de", $dodgy_utf8); # "L\x{e9}on L\x{e9}on";
40
41       See encoding::warnings for more details.
42

AUTHOR

44       Tatsuhiko Miyagawa <miyagawa@bulknews.net>
45

LICENSE

47       This library is free software; you can redistribute it and/or modify it
48       under the same terms as Perl itself.
49

SEE ALSO

51       encoding::warnings, Test::utf8
52
53
54
55perl v5.34.0                      2021-07-22      Encode::DoubleEncodedUTF8(3)
Impressum