0

I had made a form to record attendance, I tried it on local server, Arabic data was saved in the database correctly and I could read it clearly, but When the form was published to public to enter their data, I was surprised that the data was saved in database like this ( حسام صديق ) so, my question is: Is there a way to display this data in a readable way?

i tried to change charset with connection like this mysqli_set_charset($conn,"utf8"); it goes from ( حسام صديق ) to ( ÙÂيصل محمد عبد الله علي)

  • Yes, there is. You can set the character set to be used per connection. What have you tried so far? Where are you stuck? – Nico Haase Apr 05 '21 at 12:06
  • i tried this mysqli_set_charset($conn,"utf8"); and it didn't work @Nico Haase – Samar Seraj Apr 05 '21 at 13:06
  • It's a _double_ [mojibake](https://en.wikipedia.org/wiki/Mojibake) case: `'حسام صديق'.encode( 'utf-8').decode( 'cp1252')` returns `'Ø\xadسام صديق'` (stage 1) and `'حسام صديق'.encode( 'utf-8').decode( 'cp1252').encode( 'utf-8').decode( 'cp1252')` returns `'ØÂ\xadسام صدÙÅ\xa0Ù‚'` (stage 2). Examples in _Python_. – JosefZ Apr 05 '21 at 14:04

0 Answers0