AED (د.إ ) currency symbol usage issue. It moves to left
Asked Answered
L

1

6

In my application I needed to display currency conversion.

For eg:

1 ₹= 0.015 $

Similarly I want to display the conversion from AED to USD . When I try, the conversion equation gets distorted.

1 د.إ = 0.99 $ 
Langobardic answered 4/7, 2016 at 7:46 Comment(0)
L
6

The symbol د.إ is in a right-to-left script (Arabic) and each of those characters are strongly right-to-left, while the digits and $ symbol are weakly left-to-right and = is neutral. This means that the algorithm that generally does a good job of mixing left-to-right and right-to-left characters together isn't doing as well as we might hope here.

The solution is to explicitly put a right-to-left (U+200F, ‏ ‏) before the right-to-left symbol and a left-to-right mark (U+200E, ‎ ‎) after it:

$1 = 3.67‏د.إ‎

Result:

$1 = 3.67‏د.إ‎ 

(Strictly speaking we don't need the ‏ before as the strongly right-to-left nature does that for us, but it's simpler to be explicit in both cases).

This only makes sense in a context where the meaning of $ is clear; as the peso/dollar/escudo sign is used for 31 active currencies and a great many historical currencies, it's generally better to use the ISO 4217 code instead of the symbol:

1 USD = 3.67 AED

This also has the advantage of not needing to work out which currencies need the explicit ltr and rtl marks, nor having to store which currencies place the symbol before the number and which after, as the ISO 4217 codes always come after the number.

Lilian answered 6/7, 2016 at 10:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.