简体   繁体   English

PHP MySQL返回特殊字符

[英]PHP MySQL return special characters

How can I make this query also return special characters/danish letters (å, æ, ø)? 如何使该查询还返回特殊字符/丹麦字母(å,æ,ø)?

$sql = "SELECT artist_id, formated_name FROM artists WHERE formated_name LIKE '".$letter."%'";
$query = $this->db->query($sql);
$data = $query->result();

I read something about regex or str_replace ? 我读到有关regexstr_replace东西吗?

right now it returns %C3%A6 - when it comes to these letters... 现在,它返回%C3%A6当涉及到这些字母时...

thanks in advance... 提前致谢...

%C3%A6 is percent encoded data . %C3%A6百分比编码数据

You can decode it with urldecode . 您可以使用urldecode对其进行解码。

It is an odd choice of format for data stored in a database, so you should probably look into fixing whatever adds the data to the database so that it stores the actual characters instead of the percent encoded versions of them. 对于存储在数据库中的数据来说,这是一种奇怪的格式选择,因此您可能应该研究解决将数据添加到数据库中的任何问题,以便它存储实际字符而不是它们的百分比编码版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM