0

enter image description here

I am building an application using Laravel framework. In the application there are two sets of language English and Arabic. When saving Arabic language field Name and Address data into MYSQL database. it saves the Arabic language in corrupted format.

name : ÙÙÙÙ

What is that I am missing error

B L Praveen
  • 1,812
  • 4
  • 35
  • 60
  • 1
    use utf8 (or utf16 ....extra) collation for your database – OMR Jan 07 '21 at 15:23
  • 1
    see: https://stackoverflow.com/a/14371188/10573560 – OMR Jan 07 '21 at 15:26
  • I did not get. If I change collation of the database.will it be effecting to all the columns of all the tables – B L Praveen Jan 07 '21 at 15:31
  • 2
    every table has its collation, by default, it took it from db collation, you should make sure of changing the collation of your db and all your tables, I use this collation for arabic charset – OMR Jan 07 '21 at 15:37
  • 1
    Do it for single column, like : arabic for windows `$table->string('name')->collation('cp1256_general_ci');` – STA Jan 07 '21 at 15:42
  • 1
    Does this answer your question? [UTF-8 all the way through](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – apokryfos Jan 07 '21 at 15:52

1 Answers1

0

You should use unicode set of collation utf8_unicode_ci or utf8mb4_unicode_ci so it will support some specific languages chars.

probably utf8mb4_unicode_ci since it's the default for laravel.

more info and explanation about collation and the differences please check

What's the difference between utf8_general_ci and utf8_unicode_ci?

shushu304
  • 1,506
  • 1
  • 7
  • 15