0

I have arabic string and the alignment is correct (RTL) when all words in string are Arabic but when string contains Arabic and English words the string alignment not correct. when userName is English the string alignment is not correct By the way i tried this answer and didn't work

  string userName = "توم";
  string message = "يحب الورد";
  string fullString = string.Format("{0} {1}", userName, message);
  fullString is "توم يحب الورد" //correct result


  string userName = "Tom";
  string message = "يحب الورد";
  string fullString = string.Format("{0} {1}", userName, message);
  fullString is "Tom يحب الورد" //wrong result.
  fullString should be "يحب الورد Tom"  //This result is exactly what i need
SomeOne
  • 15
  • 1
  • 9
  • 2
    Possible duplicate of [incorrect right to left concatenation english and Arabic](https://stackoverflow.com/questions/39146491/incorrect-right-to-left-concatenation-english-and-arabic) – J... May 27 '19 at 19:23
  • And though the dupe is similar, here you want to force the userName string to follow RTL rules (appearing at the right as the start of the string). Following [this answer](https://stackoverflow.com/a/39147040/327083) you would substitute `LTR_EMBED = '\u202A'` for `RTL_EMBED = '\u202B'` and pad the `userName` string as in the example. – J... May 27 '19 at 19:43
  • @J... Thank you so much for your effort . i followed your post and worked! but i still have one problem that my string now looks "\u202bيحب الورد Tomu\202c". I tried to remove \u202b and u\202c but didn't work – SomeOne May 27 '19 at 21:02
  • What do you mean when you say your string "looks like" that - are you looking at it in the debugger? The debugger will show the unicode formatting characters but they should not be displayed when rendered in an application or in any controls. – J... May 27 '19 at 21:09
  • My project is Web API and the string shows like above in postman – SomeOne May 27 '19 at 21:11
  • It sounds like you need to ask a new question. – J... May 28 '19 at 00:04

0 Answers0