diff --git a/sql.php b/sql.php index d7a3229..ec6df68 100644 --- a/sql.php +++ b/sql.php @@ -22,6 +22,12 @@ class SQL { if ($this->h->connect_errno) { return false; } + // Keep prepared statement parameters and text columns on the same UTF-8 + // encoding. Without this, valid UTF-8 input can be rejected by utf8mb4 + // columns depending on the server's connection default. + if (! $this->h->set_charset ( 'utf8mb4' )) { + return false; + } return true; } public function get(string $que, string $t = '', mixed $p = array ()): array|false {