TEST2::PLUGIN::UTF8(3perl)
π Test2::Plugin::UTF8 π
okay bestie, welcome to the Perl Programmers Reference Guide page for Test2::Plugin::UTF8(3perl) β yes the manual name is doing a little scroll in the title bar, we love that for her. sit down, get comfy, this one's short and iconic. β¨
πΈ NAME πΈ
Test2::Plugin::UTF8 β the Test2 plugin that lets you test with utf8. literally that's the whole job description and she ate. π
π¦ DESCRIPTION π¦
so when you use this plugin, it makes your tests work with utf8. that's it, that's the vibe.
and like, what does "work with utf8" actually mean? two things, no cap:
- it turns on the
utf8pragma - it updates the Test2 output formatter so it uses utf8 too
both of them. together. main character energy. π
β¨ SYNOPSIS β¨
the absolute basics:
use Test2::Plugin::UTF8;
and bestie, this is basically the same thing as doing all this by hand:
use utf8;
BEGIN {
require Test2::Tools::Encoding;
Test2::Tools::Encoding::set_encoding('utf8');
}
you can ALSO turn off the utf8 import entirely (π no utf8 pragma, no problem) by passing encoding_only, which only enables the utf8 encoding on the output format:
use Test2::Plugin::UTF8 qw(encoding_only);
periodt. π
π import options π
π encoding_only
this one does not import utf8 into your test β it only turns on the encoding mode on the output.
so: import = no. output encoding = yes. simple as. β¨
π NOTES π
okay here's the little lore drop, listen up.
right now this module sets the output handles to use the :utf8 output layer. some people would rather have :encoding(utf-8) instead, because that one is more strict about verifying characters.
π«Ά and there's a whole debate about whether encoding to utf8 from perl internals can ever actually fail β so honestly it might not even matter.
but why :utf8 then?? because the alternative causes threads to segfault. no seriously. π check it: perlbug 31923 β https://rt.perl.org/Public/Bug/Display.html?id=31923
so yeah. that's the reason. not a cute reason, but a real one. π
π SOURCE π
the source code repo for Test2-Suite lives right here, go be nosy:
https://github.com/Test-More/test-more/
π MAINTAINERS π
- Chad Granum
<exodist@cpan.org>
πΈ AUTHORS πΈ
- Chad Granum
<exodist@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/
and that's the whole page bestie!! π¦ you understood it, you're slaying, I'm so proud. this was perl v5.44.0, dated 2026-10-17 β mwah, go write some utf8 tests, ily, bye!! πβ¨ππ«Ά
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND 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