2

When English and Arabic words are put together in a string, words tend do shuffle as Arabic has RTL direction where as English has LTR.

I am trying to send an email and following is the Subject of my email

String subText = "Financial Details of  شركة اختبار were sent";

The email subject appears as

were sent شركة مصنع الجـــوارب الراقيــــه . المحــدوده Financial Details of

After checking some other resource , i decided to add invisible RLE character at the start of which supposedly stops such shuffle but still getting same shuffled version.

char RightToLeftEmbedding = (char)0x202B;
subText = RightToLeftEmbedding + subText ;

What is wrong with the approach?

Community
  • 1
  • 1
Sangram Nandkhile
  • 17,634
  • 19
  • 82
  • 116

1 Answers1

1

It seems that the overall writing direction applied by the software that renders the email subject is right-to-left, possibly because it has been specifically designed or configured for use with right-to-left languages such as Arabic. The result is not really shuffled but normal right-to-left rendering, where a sequence of characters with left-to-right directionality are rendered with that directionality.

Using U+202B RIGHT-TO-LEFT EMBEDDING does not help, since it just explicitly asks for right to left direction, which is being used anyway. Instead, use U+202A LEFT-TO-RIGHT EMBEDDING.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390