# Not showing persian data correctly

**URL:** https://forum.infinityfree.com/t/not-showing-persian-data-correctly/91267
**Category:** Hosting Support
**Created:** [March 18, 2024, 1:18pm UTC](https://forum.infinityfree.com/t/not-showing-persian-data-correctly/91267 "2024-03-18T13:18:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![radin.kh](https://forum.infinityfree.com/letter_avatar/radin.kh/32/5_5575768a8748004e209b776fc1b2916d.png) [@radin.kh](https://forum.infinityfree.com/u/radin.kh)
#### Post date: [March 18, 2024, 1:18pm UTC](https://forum.infinityfree.com/t/not-showing-persian-data-correctly/91267/1 "2024-03-18T13:18:20Z")

</div>

### Website URL

[radico.epizy.com](http://radico.epizy.com)

### Error Message

The problem is that the site doesn’t show the data with persian characters from database correctly. The collation is utf8 general ci. And I tested the code with xampp with the same settings and everything was alright it might be some sort of problem in host settings. Can you help about that?

### Other Information

The first entry is 1101  
The second is 2742607331 then enter  
You can see two of them that are persian characters are question marks

---

<div class="post-metadata">

### Author: ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)
#### Post date: [March 18, 2024, 3:39pm UTC](https://forum.infinityfree.com/t/not-showing-persian-data-correctly/91267/2 "2024-03-18T15:39:18Z")

</div>

> [@radin.kh](#):
>
> The problem is that the site doesn’t show the data with persian characters from database correctly.

If I understand this correctly: you entered the data through phpMyAdmin, and it shows correctly there. But you query the data from your website, and it doesn’t show it correctly there?

If so:

> [@radin.kh](#):
>
> The collation is utf8 general ci.

You’re looking for the right thing, but in the wrong place. Collation affects how data is indexed on disk, but seeing how it is shown differently in different places, collation is not the issue.

I suspect the issue is caused by the database charset of your MySQL connection in PHP. phpMyAdmin uses `utf8` (or `utf8mb4`) for this, but PHP is configured to use `latin1` by default. So data entered with phpMyAdmin will be garbled on your site, and vice versa.

To fix this, you should always set the charset of the database connection in your code. `utf8mb4` is always a good choice for this.

If you use MySQLi: [PHP: mysqli::set\_charset - Manual](https://www.php.net/manual/en/mysqli.set-charset.php)

If you use PDO: [PHP: PDO\_MYSQL DSN - Manual](https://www.php.net/manual/en/ref.pdo-mysql.connection.php)

---

<div class="post-metadata">

### Author: ![radin.kh](https://forum.infinityfree.com/letter_avatar/radin.kh/32/5_5575768a8748004e209b776fc1b2916d.png) [@radin.kh](https://forum.infinityfree.com/u/radin.kh)
#### Post date: [March 19, 2024, 9:56am UTC](https://forum.infinityfree.com/t/not-showing-persian-data-correctly/91267/3 "2024-03-19T09:56:04Z")

</div>

Yea, thanks it got solved. I suspected that but couldn’t change it correctly till visiting the document you sent.

---

<div class="post-metadata">

### Author: ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)
#### Post date: [March 26, 2024, 9:56am UTC](https://forum.infinityfree.com/t/not-showing-persian-data-correctly/91267/4 "2024-03-26T09:56:57Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
