-1
mysqli_query($con,"SET CHARACTER SET 'utf8'");

mysqli_set_charset($con,'utf8mb4');

Using select query i get

 :جدیث: ØÂ-ضورصلیعلی۠وسلم Ù†Û’ ÙÂرمایا:

I want to this format

enter image description here

Sinto
  • 3,915
  • 11
  • 36
  • 70
Parkash
  • 9
  • 7
  • 2
    First of all: The data in your database needs to be in UTF-8. Then how did you produce that output? Remember that the browser needs to know it's UTF-8 and the font you use must be able to display the characters. – KIKO Software Jul 09 '18 at 06:55
  • Set meta charset `` – Saad Suri Jul 09 '18 at 06:55
  • not working i all ready use this keyword: Saad Suri – Parkash Jul 09 '18 at 06:56
  • follow this link :https://stackoverflow.com/questions/6859018/save-data-in-arabic-in-mysql-database – Anand Pandey Jul 09 '18 at 07:33
  • Anand Pandey use these link still not workingg – Parkash Jul 09 '18 at 10:01
  • See "Mojibake" in https://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored . If that does not suffice, then provide some more details, as indicated in that Q&A. It may even be "double encoded. Please provide HEX of a few of the characters. – Rick James Jul 09 '18 at 19:15

1 Answers1

0

The text has been mangled twice.

  1. start with رص
  2. treat that as if it were erroneously converted through latin1, I get رص. (The "Mojibake" of that is what is in step 1.)
  3. Again, doing an un-Mojibake, I see رص, which is probably part of that png. That's Arabic REH and SAD; does that sound likely?

See "Mojibake" in Trouble with UTF-8 characters; what I see is not what I stored for the likely causes. But, then, realize that the mangling was done twice!

Dig through how the text is processed. But keep in mind that there are at least 2 sequential mistakes. Perhaps even copying the data from one table/database/system to another, with each one doing its own Mojibake?

(I have been chasing charset problems for years; this is, I think, a new scenario to me!)

Undoing one stage:

CONVERT(BINARY(CONVERT('رص' USING latin1)) USING utf8mb4) --> `رص`

(Sorry if I have lost the right-to-left vs left-to-right.)

But you need to avoid latin1 at all stages. mysqli_set_charset and <meta> are only two parts of the picture.

Longer string:

`جدیث: ØÂ-ضو` --> `جدیث` --> `جدیث`
Rick James
  • 135,179
  • 13
  • 127
  • 222