Facing problem with search in Arabic Language

(Sales) #1


I am facing problem with search in Arabic Language on my live store hosted on Azure. I am using Yii1.2 framework.

On local xampp Search is working fine with Arabic Language. but when same code and database structure on live app not giving me search result.

table type: MyISAM

Character set: utf8-utf-8 Unicode

Collation: utf8_unicode_ci


name, item_no

type: varchar

Character set: utf8

Collation: utf8_unicode_ci

(Muaid M.) #2

Hi modsindex,

There is no Yii 1.2. only Yii 1.1.x and Yii 2.

I am not familiar with Azure cloud services but i can list for you the important elements so you can start looking for the issue. for this problem we have to make sure all the following:

  • php configuration file <ini>: you have to make sure the default encoding is utf8. <example: default_charset = "utf-8">
  • mysql encoding: i think you already did this step but its worth mentioning.
  • mysql connection string: the link to connect from php to mysql should be set encoding to utf-8. in Yii config.php find database component and add: ‘charset’ => ‘utf8’,
  • mysql collection for (db, tables, fields).
  • html output: should contain the meta tag for encoding and set to utf8. <head><meta charset="UTF-8"></head>
  • web server: (Apache, Nginx , etc): you have to make sure to set the default encoding to utf8. << not sure about how much important this is.
  • php files: which contains arabic better to be saved as utf8. << not sure about how much important this is.

here is some refrences that may help:


Yii 2 (yii\db\Connection class charset) http://www.yiiframew…$charset-detail

Yii 1.1 (CDbConnection class charset) http://www.yiiframew#charset-detail

i hope the above point will solve your issue. keep me posted if you find what you were looking for. wish you the best.

(Sergei) #3

Try to use utf8mb4 instead of just utf-8.
It always helps and works on my projects.