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 utf8 pragma
  • 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 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