Last active
February 10, 2020 22:17
-
-
Save iliajie/8cfeeb345b9513429798d1223d8f21bb to your computer and use it in GitHub Desktop.
Convert &#... to UTF-8 representatives
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Encode qw/encode decode/; | |
use HTML::Entities; | |
my $string = "Darf Kategorisierung verändern?"; | |
$string = decode("big5", $string); # big5 to internal utf8 -> utf8::is_utf8($string) is true | |
decode_entities($string); # decode HTML entities | |
$string = encode('utf8', $string); # internal utf8 to raw bytes, utf8::is_utf8($string) is false | |
say $string; # Darf Kategorisierung verändern? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment