How to add vowel to arabic letter from unicode/hexentity
for example i have:
- U+FE8F ( ﺏ ) and want to add this vowel U+FE76 ( ﹶ ) -> ﺏﹶ
- U+FE8F ( ﺏ ) and want to add this vowel U+FE78 ( ﹸ ) -> ﺏﹸ
I do it by js
let s1 = document.createElement('span') s1.innerHTML = "ﺏ ﹸ or ﺏﹸ" document.querySelector('#text').append(s1)
thanks in advance.
Advertisement
Answer
The Arabic script in Unicode has in general five (5) forms of Unicode:
General form letter (the normally used)
(Contextual form) Isolated form letter.
(Contextual form) End form.
(Contextual form) Middle form.
(Contextual form) Beginning form.
The Contextual forms have Unicodes from uFE80.
Examples here:
More information here on Wikipedia.
When working with Arabic Letters (strings) use the General form (code) to do your string manipulations. The system takes care and detects the position of the letter within others and creates the right form out of the other 4 forms.
Now, if you start using the other forms. In your case, you have an Isolated Form that you want to concatenate to another Isolated Form letter it will not join.
An Isolated Form Letter needs a non-isolated form letter to join with.
In short, two Isolated Letters will not join and will remain isolated.
Here are some code examples:
//============================================ // Isolated Characters Codes //============================================ console.log("----------- Isolated Letters Not Joining-------------") let b_isolated = "ﺏ"; // isolated letter code U+FE8F let t_isolated = "ﺕ"; // isolated letter code U+FE95 console.log(b_isolated+t_isolated); // ﺏﺕ will never join console.log(b_isolated+'uFE78'); // ﺏﹸ will never join console.log(b_isolated+'uFE76'); // ﺏﹶ will never join //============================================ // Normal/General Characters //============================================ console.log("----------- General Letters Joining -------------") let b_general = "ب"; // code U+0628 let t_general = "ت"; // code U+062A console.log(b_general+t_general); // بت joined // add normal accents to the normal letter console.log(b_isolated+'u064E'); // ﺏَ joined console.log(b_isolated+'u064F'); // ﺏُ joined
When using Arabic characters use the Unicode range u0600 to u06FF with sample here: