Reputation: 1
I am trying to generate a query string. Characters show up as different queries.
Php version:7.3.2
Function
$D->query = '';
if ($this->query('x')) {
$D->query = mb_convert_encoding($this->query('x'), 'UTF-8');
}
Result for #Синодал:
#%D0%A1%D0%B8%D0%BD%D0%BE%D0%B4%D0%B0%D0%BB
Upvotes: 0
Views: 128
Reputation: 11
The string is urlencoded, you need to simply urldecode first, from there you can do any encoding changes:
$decoded = urldecode($this->query(“x”));
$D->query = mb_convert_encoding($decoded, “utf-8”);
Upvotes: 1