I have the following tiny nodejs script which just console logs an arabic verb:
var verb = "كتب";
console.log(verb);
However, the console log gives me: output: بتك
- which is the verb, but inverted. (So instead of getting abc
I get cba
).
I guess that this is because nodejs does not know that I am using a right-to-left language, such as Arabic. However, I was not able to find anything online, on how to fix this? Is there some setting I don't know of?
PS: What's interesting is also, that while the letters are inverted, their their form is basically correct - so the first letter, although displayed at the end, still has the correct form of a first letter in Arabic (in Arabic, letters take on different forms, depending on the position in the word)
Although i am not sure why it is doing that (i cant reproduce it in chrome console).
You could try reverse the string before output like so:
var verb = "كتب";
console.log(verb.split("").reverse().join(""));
Bro it's just because of the console , your word will still conserved as it is if you try to send it in the response object for testing.
There's a package on npm for displaying the Arabic text correctly on consoles/terminals that don't support it.
https://www.npmjs.com/package/rtl-arabic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With