Working with Persian/Farsi on a Website HTML / PHP / MYSQL

It took me a few hours to figure this out. Though it turned out to be quite simple. Everything needs to be in UTF-8.


Use the charset meta tag below:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>


The field needs to be collated “utf_8_persian_ci”.


Set the charset

At the top of the document specify:
header(“Content-type: text/html; charset=utf-8”);

Set the database

Just after opening the database connection specify utf-8 with the following command:


Optionally, these open-source fonts can be uploaded and used with @fontface in the stylesheet.

One Comment

  • Mostafa

    Hello please note that mysqli_set_charset(); requires two parameters first for connection second for charset :

    mysqlli_set_charset($conn, “utf8”);

    and now question marks are gone. worked fine…

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.