mysqli_result::fetch_field()
returns a type
property for each column, which is an integer value.
The integer value is the same for VARCHAR and VARBINARY (0xFD
) columns and also for CHAR and BINARY (0xFE
) columns. Those column types can be detected with MYSQLI_TYPE_STRING
and MYSQLI_TYPE_VAR_STRING
constants.
To know if a string column is BINARY (they have a collation called binary
), or to know if columns need to be converted to another character set, the character set name is really needed.
But... mysqli_result::fetch_field()
has a charsetnr
property which again returns an integer for the character set. Only this time there seems to be no way of knowing the character set name, let alone the collation?
So how can one get the character set names from mysqli_result
?