Share via


Mixed Time Date display

Hi, I wanted to continue posting in this blog in a hope that it would help people understand more the challenges in Arabic application development. Today, I'll talk a little about some wrong behavior in the mixed Arabic \English display of dates. I hope it's a useful insight to the issues in hand.

I got a question about wrong date display in an Arabic application. The date was displayed as follows: " PM 3/8/2008 5:00"

The DateTime format depends on your control panel\regional settings. I assume that your User locale is not Arabic, therefore you have “PM” instead of “ص”. So having “PM” is expected.

The unexpected rendering where you have PM then date then time.. happens because the OS uses the bidi Unicode algorithm to render text. I’ll try to describe what happens:

This is the English text:

Time

PM

Date

Output

1) When FlowDirection= RighToLeft.

2) The OS assumed that we have Arabic text, therefore the numbers and neutral chars are considered Arabic they would render accordingly. (you find the time is rendered on the right-hand side “the beginning in Arabic”)

Time

3) Then you have “PM” English text.. this is a new run and the following text is considered English until you meet something Arabic

4) Then you find numbers and neutral characters that don’t enforce Arabic display, so it’s still considered English

PM Date

Time

This is the way the OS displays mixed strings. It’s not good nor intuitive, all Arabic native speakers don’t find it logical. However, not following the Unicode bidi algorithm creates many more undesired behaviors.

On the bright side, when the system is correctly displaying Arabic date with "ص" the time date format would display properly.

Comments