ضرورت لوڈ
is "Mojibake" for 'ضرورت لوڈ'. It comes from one form of mistake.
??????
comes from a different mistake.
- I assume the bytes in your client are utf8-encoded. (Good)
- You connected with
SET NAMES latin1
(or set_charset('latin1')
or ...), probably by default. (It should have been utf8
.)
- The column(s) in the table(s) were probably
CHARACTER SET latin1
. (It should have been utf8.)
- The HTML output should include
<meta charset=UTF-8>
.
Let's check one more thing... Please do SELECT col, HEX(col) FROM tbl WHERE...
to pick up that string (or something like it). You should see
D8B6 D8B1 D988 D8B1 D8AA D984 D988 DA88
(without the spaces) for the HEX for 'ضرورت لوڈ'. If you do, then it was correctly stored. If you get this, you have the dreaded "double encoding":
C398 C2B6 C398 C2B1 C399 CB86 C398 C2B1 C398 C2AA C399 E2809E C399 CB86 C39A CB86
Back to the title... "ASCII", at least the 7-bit stuff that includes digits and English letters, is a subset of utf8. So, there is never a need to "convert ascii to utf8".
Bottom line:
- Don't use mysql_* API; switch to mysqli_* or PDO.
- Establish utf8 on the connection:
mysqli_set_charset('utf8')
or equivalent.
- Make sure the column/table is
CHARACTER SET utf8
. (See note below.)
- Check the html for the meta tag.
Note: If the CHARACTER SET
is not utf8, I need to know what the HEX is before advising you on how to ALTER
the table without screwing things up further.