Here is the problem, in a working unit test. I think it's either a bug in DBI DBD::mysql, with respect to how it handles MySQL JSON columns, or a bug in my brain.
use strict;
use warnings;
use utf8;
use Test2::V0;
use Test2::Plugin::UTF8;
use Test2::Plugin::NoWarnings echo => 1;
use DBI;
use DBD::mysql 4.041; # 4.041 required for utf8mb4
use JSON 4.01 qw//;
use Encode;
#
# setup $dbh, create test table
#
my $dbname = '';
my $host = 'localhost';
my $user = '';
my $pass = '';
my $dbh = DBI->connect(
"DBI:mysql:" . ($dbname || '') . ";host=" . $host,
$user,
$pass || undef,
{ RaiseError => 1, PrintError => 0, AutoCommit=> 1 }
);
$dbh->{'mysql_enable_utf8mb4'} = 1;
$dbh->{'charset'} = 'utf8';
$dbh->do("CREATE TABLE IF NOT EXISTS `test` (id int unsigned, `my_json` json NOT NULL, `my_text` mediumtext NOT NULL)");
#
# create and insert test data
#
# A use case for spam! Got this junk from spam inbox
my $utf8str = "ion?• été e 