Re: unicode data in ascii template

Dave Howorth <dhoworth-fDajt2Yx3S8pY9vWkoisglpr/1R2p/[email protected]> Fri, 10 Jan 2014 16:19:17 +0000
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Organization MRC Laboratory for Molecular Biology
Message-ID <[email protected]>
Bill Moseley wrote:
> On Fri, Jan 10, 2014 at 6:51 AM, Dave Howorth <dhoworth-fDajt2Yx3S8pY9vWkoisglpr/1R2p/[email protected]>wrote:
>> Solved it ...
> Cool.

I spoke too soon. I've got a different problem now (more below ...)

>> - one module used by my main program was making its own connection to
>> the database (for historical reasons). Apparently that changes the
>> mysql_enable_utf8 setting on my main connection. I'm sure DBIC has a
>> good reason for that which I ought to know, but it sure wasn't something
>> I was expecting. Praise be to the debugger for finding that.
> 
> It would not be DBIC, but DBD::mysql.  I'd be surprised if that wasn't a
> per-connection setting.

Exactly. I too am surprised that it isn't a per-connection setting.
IIRC, it's DBIC that does connection sharing, but it's been a while.



The problem I've got now concerns the rest of the data in the database.
Most of the other tables are latin1 rather than utf8 (although they only
contain ASCII characters). It's not my database, I hasten to add. I just
did a query that failed with the error:

DBIx::Class::ResultSet::find(): DBI Exception: DBD::mysql::st execute
failed: COLLATION 'latin1_general_ci' is not valid for CHARACTER SET
'utf8' ...

So I quickly changed the collation in the query to 'utf8_general_ci' and
reran the program. This time it failed with:

DBIx::Class::ResultSet::find(): DBI Exception: DBD::mysql::st execute
failed: COLLATION 'utf8_general_ci' is not valid for CHARACTER SET
'latin1' ...

So I'm back to pulling my hair out. I expect this is a mysql feature
though rather than TT or DBIC.

Cheers, Dave