TEST2::PLUGIN::UTF8(3pm)

πŸ’– NAME πŸ’–

okay so like, Test2::Plugin::UTF8 β€” it's a Test2 plugin that lets you test with utf8. that's the whole vibe. and yes bestie, this is the page for Test2::...in::UTF8(3pm) from the Perl Programmers Reference Guide, so you're in the right place 🫢


✨ DESCRIPTION ✨

the way this plugin just works β€” when you use it, it makes your tests play nice with utf8. and what does that even mean? two things, bestie:

  • it turns on the utf8 pragma
  • it updates the Test2 output formatter so it uses utf8 too

that's it. that's the slay. πŸ’…


🌸 SYNOPSIS 🌸

use Test2::Plugin::UTF8;

lowkey this is doing the same thing as this whole situation:

use utf8;
BEGIN {
    require Test2::Tools::Encoding;
    Test2::Tools::Encoding::set_encoding('utf8');
}

like, same energy, way less typing. iconic behavior honestly. ✨

you can ALSO skip the utf8 import entirely by passing 'encoding_only' β€” that just enables utf8 encoding on the output format and nothing else:

use Test2::Plugin::UTF8 qw(encoding_only);

πŸŽ€ import options πŸŽ€

πŸ¦‹ encoding_only

does not import utf8 into your test β€” it only enables the encoding mode on the output. so if you want the output formatted all cute and utf8-y but you don't want the pragma messing with your test file, this is your girl. fr fr. πŸ’œ


πŸ’€ NOTES πŸ’€

heads up bestie, this is the important part, don't skip it πŸ™ˆ

this module currently sets output handles to have the ':utf8' output layer. now, some people might prefer ':encoding(utf-8)' because it's way more strict about actually verifying characters. there's a whole debate about whether encoding to utf8 from perl internals can even fail at all β€” so it may not matter either way. 🀷

but here's the real reason it went this way: the alternative causes threads to segfault. yeah. segfault. not cute. see perlbug 31923 β€” https://rt.perl.org/Public/Bug/Display.html?id=31923 β€” for the receipts. πŸ’€


πŸ”₯ SOURCE πŸ”₯

the source code repository 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 a wrap, bestie πŸŽ€βœ¨ this was Test2::...in::UTF8(3pm) from perl v5.42.3, dated 2026-11-03 β€” go forth and be utf8-coded πŸ’–πŸ¦‹

πŸ“¦ where this page comes from