views:

16

answers:

2

on my page i have a time range printed in the format of

12:00 AM - 12:00 PM

i have to display this appropriately for whatever culture the browser supplies. i'm having an issue with arabic (ar-ae): the am/pm indicator seems to change the text ordering for part of the string. the string has the right characters in the right places in memory, but shows them in a different order.

so for my start and end times, i have strings like

03:00 ص

and

11:00 م

and then i put them together like

string dummytext = t1string + " - " + t2string;

when the page is written, the range is displayed as

03:00 ص - 11:00 م

i've tried putting each piece in a Label control and wrapping everything in a div with dir="ltr" and haven't made any progress. this is happening in a table cell if it makes any difference.

+1  A: 

this seems to fix it: i added the "left-to-right" unicode character after the arabic character for "AM" in the example above.

string dummytext = t1string + "‎ - " + t2string;

‎ is the html entity for the ltr character. http://www.fileformat.info/info/unicode/char/200e/index.htm

the page now displays

03:00 ص‎ - 11:00 م
lincolnk
A: 

Wouldn't you want to be using the "right to left" (dir="rtl")?

NinjaCat
not in my case. the site is mostly english text, left to right. dates and times use local formatting/characters but still need to be ltr for consistency.
lincolnk
then could you surround the dates and times with a div tag that has the rtl set in CSS?
NinjaCat