On Wed, Oct 13, 2021 at 12:27:30PM -0400, post...@ptld.com wrote:

> I received the following logged errors
> 
>  query failed: Illegal mix of collations
>    (latin1_swedish_ci,IMPLICIT) and 
>   (utf8mb4_general_ci,COERCIBLE) for operation '='
> 
>     query = SELECT email FROM aliases WHERE alias = '%s' AND acceptMail LIMIT 
> 1

MySQL is a client/server database, when the database is created
it is a assigned a character set for encoding text strings, and
crucially also a "collation order" for comparing strings so that
they can be stored in B-trees and compared with "<", ">", ...

MySQL client applications also choose a character set and collation, to
signal to the server how they encode text strings and expect to be able
to compare them.  The client and server choices have to be compatible.

If you're storing or perform lookups on any non-ascii data the client
and server encoding should be the same.

You might want to use a UTF-8 encoding when creating the database and
choose the same on the client end.

This has nothing to do with SQL-injection.  And everything to do with
i18n.

-- 
    Viktor.

Reply via email to