> What MySQL makes of such data is up to the MySQL client and server
> libraries, but Postfix does not promise that the input will be well-formed
> UTF-8, or ISO Latin or anything of the sort. Just an array of bytes.

Right, as it should be. Envelope addresses are not associated with any
character set according to RFC 5321, they are just strings of octets.

For this reason an appropriate SQL data type for such fields is
VARBINARY (or BYTEA in PostgreSQL).  A data type CHAR or VARCHAR
is inappropriate, as it associates a character set with data.  SQL may
perform validation of data according to the specified character set.
MySQL tend to be quite premissive to such violations, but there is
no guarantee. Also, comparing CHAR or VARCHAR strings with
relational operators is case-insensitive and may even apply
special (like Unicode) rules for character equivalency.

  Mark

Reply via email to