Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 $ 
like image 452
Vivek Verma Avatar asked Jul 04 '16 07:07

Vivek Verma


People also ask

Where does the currency symbol go?

In American English, the currency symbol is placed before the amount; the same is true for British English. It is $20, not 20$.

How do you use currency symbols?

Symbol PlacementIn the US, we're used to the dollar symbol being to the left of the dollar amount. But currency symbol placement changes based on geographic location. For example, countries in the European Union place the euro symbol to the right of the dollar amount.

What does the currency symbol represent?

A currency symbol is a graphical representation that denotes the name of a currency. The symbol is usually, but not always, unique to a specific country or region. These shorthand currency identifiers often appear instead of formal currency names in international and domestic markets.

Why do currency signs have two lines?

The lines across currency symbols make them easier to identify clearly in handwritten documents. An error in the identification of even one alphanumeric character or symbol in a handwritten document can result in a very costly mistake or a lawsuit. Clear, unambiguous documents are also harder to forge.


1 Answers

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.

like image 96
Jon Hanna Avatar answered Sep 26 '22 02:09

Jon Hanna