Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

108
Vistas
Trouble adding the shaddah diacritic to an Arabic letter (JavaScript)

I am having some issues with the Arabic diacritic 'shaddah' in my code.

this.nfpp = this.pastTenseStem + this.roots[2] + "تُنَّ";

(I appologize the characters are so small, I'm not sure how to make it any bigger. You can see here that the shaddah is a little 'w' shaped character that sits on top of Arabic letters. In my code it is sitting on the ن in "تُنَّ", the second letter of the string, because Arabic is read right to left.)

This code should assign to the variable nfpp the value of the string pastTenseStem plus a character string plus the string "تُنَّ". However, when the code executes, instead of تُنَّ being added, تُّنَ is added (the shaddah changes which letter it is on). I've repeated the process for other different types of diacritical markings and they all behave as expected, except for this one. If I remove the shaddah, and just add تُنَ, then things work again as expected. Furthermore, experimenting in the console produces the expected result.

"فَعَل" + "ْتُنَّ"
>>'فَعَلْتُنَّ'

I'm really stumped here so I'd appreciate any help. Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After doing a little more digging I seem to have found the cause of the error, albeit with no explanation as to why that may be causing the issue. The issue was the font. I could see by looking at the string split into an array of characters that everything was as I expected it to be. Changing the font proved this.

Default font

Arial font

That is to say, the string was always correct, but the font was rendering it incorrectly.

In case anyone has the same issue that I had, my best guess is that the issue was in the way the default font rendered the combination of the ت and the ن. Other letters inserted between the two behave as they should and are rendered correctly.

Example

Even lengthening the connection between the two letters stops the font from rendering in the way that causes the bug. Example

Furthermore, the problem also exists with ب and ن, and with other vowel markings than just fathah, dammah, and kasrah, although not with sukun.

To summarize, to the best of my finding, when a word ends in either a ن with a shaddah and fathah, kasrah, or dammah preceded by either a ت, a ث, a ب, or a ن with a fathah, kasrah, or dammah, but not sukun, the shaddah moves from the ن to whatever letter proceeds it. I have no idea why, or how to fix it, but changing fonts was a fine workaround for me.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda