Riot currently doesn't have good support for RTL languages. Complete lines of RTL characters are somewhat manageable but when there's a sequence of LTR characters in the middle, it messes up the sequence to display the words in.
Perhaps Riot should detect whether a line starts with RTL characters and then treat it all as RTL.
Related to #1712. Needs more <span dir="auto">.
Take this text, for example:
یہ ایک مثال ہے۔ درمیان میں left-to-right متن آنے پر متن کی ترتیب بدل جاتی ہے۔
(Not displaying correctly even on github)
The way it should show up is

But it shows up in Riot as

(Slight variation in the font. Hopefully it's clear enough.)
The web & Desktop version of Riot does not support RTL languages such as Arabic, Persian, Hebrew, etc. While the Android app can detect the language automatically and things are shown properly.
For example, if you put an exclamation mark at the end of the Persian phrase خوش آمدید, it will be shown at the first of it:
خوش آمدید!
Look, we read/write from right side to left, so the end of a sentence is at the left side. so, in case of خوش آمدید!, the ! mark should be at the left of the phrase.
This looks like it's been fixed, Riot now displays

Yes, it is working in Firefox. Let me check in Chrome and the electron app.
Also fixed in the mobile app.
fixed in https://github.com/matrix-org/matrix-react-sdk/pull/955 I think \o/
Fixed in Chrome. So I guess it will be fixed in the electron app too. Both are webkit, right?
@saad440: yes.
Shame we don't right-justify the text: opened #4771 to track it
Fixed in the electron app too.
Most helpful comment
fixed in https://github.com/matrix-org/matrix-react-sdk/pull/955 I think \o/