0

I used to upload my websites on namecheap and when uploading arabic content it was stored like this in database "سيارة خضراء" but display fine on website but now when I uploaded the site and database on different hosting on another company the data displays as "سيارة خضراء" is there is anything to solve this problem I tried searching a lot! Also I'm wondering if the problem is related to server charset and if so how to change it?

I tried putting codes like

$sSQL= 'SET CHARACTER SET utf8';
mysqli_query($con,$sSQL);
mysqli_query("SET NAMES 'utf8'");
mysqli_query('SET CHARACTER SET utf8');
mysqli_set_charset($link, "utf8");

but nothing worked!

  • Worth checking the near canonical resource [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through). – tadman Feb 10 '23 at 23:05
  • I tried all of that but nothing changed. the problem is it displays fine on namecheap but current server is displaying the data as the same not decoding them or something like that – Omar Magdi Feb 10 '23 at 23:13
  • Can you give some example text and how it shows up? Or how ends up encoded? The way it gets mangled can provide clues as to what's going wrong. Remember, be *sure* your page is set as UTF-8 encoded as well. – tadman Feb 10 '23 at 23:33
  • My problem is that the data is stored in other format not arabic but when displaying the data it displays fine. that was on namecheap but now when I uploaded the database on another shared hosting the data displays the same not correct – Omar Magdi Feb 10 '23 at 23:54
  • 1
    Connection is `$con` or `$link`? Middle two queries are missing connection link entirely so they will fail. – user3783243 Feb 11 '23 at 00:49
  • If it's displaying fine, but mangled in the DB then you have the opposite problem. Somehow you're scrambling it when saving. In any case, we need a known bit of text, and an example of how it's encoded. Emoji of any kind are good because they test that `utf8mb4` encoding is set properly, but Arabic should work as well. – tadman Feb 11 '23 at 00:50
  • Mysql column collation should be `utf8mb4_unicode_ci` – Indra Kumar S Feb 11 '23 at 03:33

0 Answers0