Twitte...ntities(3pm)
π NAME π
Twitter::API::Trait::DecodeHtmlEntities β bestie, it decodes HTML entities in strings. That's the whole vibe. It's a Perl module page, from the User Contributed Perl Documentation collection, section 3pm, and it's here to un-mangle your tweet text. β¨
πΈ VERSION πΈ
version 1.0006 β yes she's numbered, yes she's iconic π
π¦ SYNOPSIS π¦
okay so here's literally how you use it:
use Twitter::API;
use open qw/:std :utf8/;
my $client = Twitter::API->new_with_traits(
traits => [ qw/ApiMethods DecodeHtmlEntites/ ],
%other_options
);
my $status = $client->show_status(801814387723935744);
say $status->{text};
# output:
# Test DecodeHtmlEntities trait. < & > XX X 'single' "double"
#
# output without the DecodeHtmlEntities trait:
# Test DecodeHtmlEntities trait. < & > XX X 'single' "double"
look at that glow-up between the two outputs. The trait turns < & > into the actual < & > characters, and leaves XX, X, 'single' and "double" exactly as they were. π«Ά
π«£ ngl, the trait name in thatqw/.../list is spelledDecodeHtmlEntitesβ missing aniβ and that's exactly what the original says, so I'm leaving it exactly as-is. Copy it character for character, bestie. Don't "fix" it. The way that typos are load-bearing sometimes π
π DESCRIPTION π
So here's the tea β: Twitter has trust issues. They assume you're gonna take the text you get back in API responses and shove it straight onto a web page without HTML encoding it. Rude, honestly.
But likeβ¦ you do HTML encode all your output, right? Right?? π₯Ί Because if you do, then Twitter's lack of trust means you end up double encoding entities. Which is giving disaster. π
So, include this trait and Twitter::API will decode HTML entities in all of the text returned by the API.
You're welcome. π
π AUTHOR π
Marc Mims <marc@questright.com> β the icon, the legend, the main character who wrote this π«‘
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2015-2021 by Marc Mims.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie!! β¨πΈπ This was Twitter::API::Trait::DecodeHtmlEntities, version 1.0006, part of the User Contributed Perl Documentation, and the original page was generated by perl v5.32.1 on 2021-09-11. slay, go decode some entities, no cap π¦π
π¦ where this page comes from
- debian bookworm: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtwitter-api-perl 1.0006-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms