I can insert arabic arabic/hebrew/chinese on my local machine which is: Windows 10 / xampp / PHP 5.6.23 / MySQL 5.7.19
But not on Prod server: Ubuntu 16.04 LTS / nginx / PHP 7.0.22 / MySQL 5.7.20
The collation of the table's field to insert text in is utf8_unicode_ci.
The PHP code to insert in database is just simple:
$sql = $dataBase->prepare('INSERT INTO sa__user_desc(user_id,
lang,
description)
VALUES(:user_id,
:lang,
:desc)');
$sql->execute(array('user_id' => $theId,
'lang' => 'ar',
'desc' => $value));
$sql->closeCursor();
That's strange because, on the server it's not inserting anything, absolutely no new lines when trying to insert one of the mentioned languages above. But working and inserting new lines when inserting text in English or Deutsch or French for example.
And there is no errors on log file /var/log/nginx/mywebsite.com-error.log ! So that's really strange!
UPDATE
It's working when inserting Chinese characters using phpMyAdmin. So it's not the MySQL database, issue might come from PHP.
SOLUTION
It was a PHP issue: if(str_word_count($value) != 0) {
returns 0 when $value
contains some Arabic text for PHP 7.0.22 and not 0 for my local install with PHP 5.6.23.
So I changed it to if($value != '') {
.
I know I should have the same version of PHP on both DEV and PROD environments but that means I have to take some time to check how to upgrade it on xampp. :P