Reputation: 594
I am inputting Arabic text via Unicode into a Richtextbox and it is all looking OK. The numbers below are as it should look for the example Text on left and numbers on right. The box is the exact size so I am not worried about having on right or left of screen. Image and Unicode is below
FE9E FE98 FEB8 FEC6 FEEB 0020 0660 0662 0664 0668
I then try to copy it to another richtext box and the text flips around and changes first and last char which is not what I want and the numbers move to left of text again not what I want.I want to copy byte for byte.
I found something about the Left and Right mark and tried that but still it does not work
rchtxbx_bottom.SelectionFont = new System.Drawing.Font("San Serif", 20);
rchtxbx_bottom.AppendText("Copied string = " + rchtxbx_top.Text + "\r");
rchtxbx_bottom.SelectionFont = new System.Drawing.Font("San Serif", 20);
rchtxbx_bottom.AppendText("Right to Left Mark = \u200F" + rchtxbx_top.Text + "\u202C\r");
rchtxbx_bottom.SelectionFont = new System.Drawing.Font("San Serif", 20);
rchtxbx_bottom.AppendText("Left to Right Mark = \u200E" + rchtxbx_top.Text + "\u202C\r");
rchtxbx_bottom.SelectionFont = new System.Drawing.Font("San Serif", 20);
rchtxbx_bottom.AppendText("ForceLTR string = " + ForceLTR(rchtxbx_top.Text) + "\r");
I also tried right to left in the textbox Properties menu. What I get is
Any ideas of how I can get round this issue?
Upvotes: 2
Views: 496
Reputation: 594
I solved the issue eventually by creating a function that checks each Char in Unicode. If it is from page FE then I add \u202C after it as shown below.
string us = string.Format("\uFE9E\u202C\uFE98\u202C\uFEB8\u202C\uFEC6\u202C\uFEEB\u202C\u0020\u0660\u0662\u0664\u0668 Aa1");
Upvotes: 1