diff --git a/src/danog/MadelineProto/Db/MysqlArray.php b/src/danog/MadelineProto/Db/MysqlArray.php index ed72dc0d..614e99e0 100644 --- a/src/danog/MadelineProto/Db/MysqlArray.php +++ b/src/danog/MadelineProto/Db/MysqlArray.php @@ -353,6 +353,13 @@ class MysqlArray implements DbArray return []; } + if ( + !empty($params['index']) + && !mb_check_encoding($params['index'], 'UTF-8') + ) { + $params['index'] = mb_convert_encoding($params['index'], 'UTF-8'); + } + try { $request = yield $this->db->execute($query, $params); } catch (\Throwable $e) { diff --git a/src/danog/MadelineProto/Db/PostgresArray.php b/src/danog/MadelineProto/Db/PostgresArray.php index 213c26ba..995affe4 100644 --- a/src/danog/MadelineProto/Db/PostgresArray.php +++ b/src/danog/MadelineProto/Db/PostgresArray.php @@ -365,6 +365,13 @@ class PostgresArray implements DbArray return []; } + if ( + !empty($params['index']) + && !mb_check_encoding($params['index'], 'UTF-8') + ) { + $params['index'] = mb_convert_encoding($params['index'], 'UTF-8'); + } + try { $request = yield $this->db->execute($query, $params); } catch (\Throwable $e) {