Consider the following string of text:
All of the following words use the letter ر (also known as resh or raa).
The letter ر is almost the same as the English ‘R‘ sound.
"ﺭَﺃَﺏَ, ﺭَﺃَﺱَ, ﺭَﺃﺱ, ﺭَﺋِﻴﺲ, ﺭَﺋِﻴﺴِﻲّ "
Suppose that someone fluent in English wanted to learn Arabic writing (حروف) one letter at a time by writing Arabic in the English writing system, except that the student replaced the letter R
with one Arabic letter resh.
After practicing with a few paragraphs, the student begins to use two Arabic letters instead of one letter.
Eventually, the entire text is written in Arabic حروف.
At first, I was hoping to replace one Arabic letter only.
text = "ﺭَﺃَﺏَ, ﺭَﺃَﺱَ, ﺭَﺃﺱ, ﺭَﺋِﻴﺲ, ﺭَﺋِﻴﺴِﻲّ "
rtext = repr(text.encode('utf-8'))
# the letter `xd8xb1` (raa or resh) represents the 'R' sound.
# text = text.replace('ر', "R")
rtext = rtext.replace("\xd8\xb1", "R")
print(text)
print(40*'#')
print(rtext)
The problem is that "\xd8\xb1"
is not the only Unicode encoding for the letter resh. None of the reshes were replaced, because they are written as resh with an accent on top.
How do I use Python to replace the Arabic letter resh
with an English or Latin-style letter R
?
What are the other choices for resh?
In European languages, there exist Unicode numbers for R
with an accent written above the letter.
Symbol | Base Sixteen Hexadecimal Notation |
Base Ten Decimal Notation |
---|---|---|
Ŕ |
154 |
340 |
Ŗ |
156 |
342 |
Ř |
158 |
344 |
Ȑ |
210 |
528 |
Ȓ |
212 |
530 |
Ṙ |
1E58 |
7698 |
Ṛ |
1E5A |
7770 |
Ṟ |
1E5E |
7774 |
ᴿ |
1D3F |
7487 |
???? |
1D411 |
119825 |
ℝ |
52 |
82 |
Ⓡ |
24C7 |
9415 |
Whare are the Unicode values for all of the variants on the Arabic letter RA (also known as resh)?