Debian Buster -> Bullseye upgrade issue with UTF8?

[email protected] (Simon Cruickshank) Tue, 17 Aug 2021 08:41:03 +0100
Newsgroups perl.dbi.users
Message-ID <CADXRn-huG+ciqrgA=PrCqOU4WvaYLX0qSKcns+2hH5=GX=brqQ@mail.gmail.com>
--000000000000bb2c1305c9bc72d0
Content-Type: text/plain; charset="UTF-8"

I use perl CGI::Session on a Debian buster box, after upgrading to Bullseye
the website barfs with message :-

DBD::mysql::db do failed: Incorrect string value:
'\xF9\x08a\x00\x00\x00...' for column `webapp`.`sessions`.`a_session` at
row 1 at /usr/share/perl5/CGI/Session

I can recreate the issue without CGI:Session with the following code.

#! /usr/bin/perl -w
use strict;
use DBI;

my ($dbh, $sth, $count);

$dbh = DBI->connect
("DBI:mysql:host=localhost;database=webapp","webadmin","?????????",
{PrintError => 0, RaiseError => 1});
$sth = $dbh->prepare ("insert into sessions values (?,?)");
my ($id,$a_session) = ($ARGV[0],$ARGV[1]);
$a_session = "\x{F9}";
$sth->execute ($id,$a_session)
or die $DBI::errstr;
$sth->finish ();
$dbh->disconnect ();
exit (0);

So the issue just seems to be with UTF8? This works fine on Buster but not
Bullseye. If I encode_utf8 the string the insert works.

Is this a change in the mysql backend or a change in the DBI?

Any help would be greatly appreciated.

Best Regards,

Simon

--000000000000bb2c1305c9bc72d0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I use perl CGI::Session on a Debian buster box, after=
 upgrading to Bullseye the website barfs with message :-<br></div><div><br>=
</div><div>DBD::mysql::db do failed: Incorrect string value: &#39;\xF9\x08a=
\x00\x00\x00...&#39; for column `webapp`.`sessions`.`a_session` at row 1 at=
 /usr/share/perl5/CGI/Session</div><div><br></div><div>I can recreate the i=
ssue without CGI:Session with the following code.</div><div><br></div><div>=
#! /usr/bin/perl -w<br>use strict;<br>use DBI;<br><br>my ($dbh, $sth, $coun=
t);<br><br>$dbh =3D DBI-&gt;connect (&quot;DBI:mysql:host=3Dlocalhost;datab=
ase=3Dwebapp&quot;,&quot;webadmin&quot;,&quot;?????????&quot;,<br>	{PrintEr=
ror =3D&gt; 0, RaiseError =3D&gt; 1});<br>$sth =3D $dbh-&gt;prepare (&quot;=
insert into sessions values (?,?)&quot;);<br>my ($id,$a_session) =3D ($ARGV=
[0],$ARGV[1]);<br>$a_session =3D &quot;\x{F9}&quot;;<br>$sth-&gt;execute ($=
id,$a_session)<br>or die $DBI::errstr;<br>$sth-&gt;finish ();<br>$dbh-&gt;d=
isconnect ();<br>exit (0);</div><div><br></div><div>So
 the issue just seems to be with UTF8? This works fine on Buster but not
 Bullseye. If I encode_utf8 the string the insert works.</div><div><br></di=
v><div>Is this a change in the mysql backend or a change in the DBI?</div><=
div><br></div><div>Any help would be greatly appreciated.</div><div><br></d=
iv><div>Best Regards,</div><div><br></div><div>Simon<br></div></div>

--000000000000bb2c1305c9bc72d0--