Hi @mohammadreza,
Maybe you need tou use Unicode characters to replace the letter "ي" (if you look at Unicode character list Arabic, you will se the letter "ي" have "U+064A"). This is the Unicode characters for Basic Latin (letter d = U+0064).
So, if I use this (if you have only one letter):
(setq ent (entget (car (entsel "\nSelect TEXT or MTEXT:"))))
txt (cdr (assoc 1 ent))
)
From "txt" variable I get "\U+064A" which represent the letter "ي"
and, if you want to substitue the letter "ي" with letter "d", use the next line of code
(entmod (subst (cons 1 "\U+0064") (cons 1 txt) ent))
where "\U+0064" represent the letter "d"
I get the desired output.
Also, if you have something like this "{\\fArial|b0|i0|c178|p34;\U+064A} {\\fArial|b0|i0|c178|p34;\U+064A}", use this Lee Mac UnFormat String to clean everything and get "\U+064A \U+064A". To do this, you need first to clean string to get "\U+064A \U+064A", then replace old string (for e.g. "{\\fArial|b0|i0|c178|p34;\U+064A} {\\fArial|b0|i0|c178|p34;\U+064A}") with "\U+064A \U+064A" using (entmod (subst ....), then again get data about entity, use "\U+0064 \U+0064" to substitue "\U+064A \U+064A". I know it's confusing, but you need to try it on your own.
Best regards.