question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Pasting Arabic text may make it left-to-right

See original GitHub issue

Describe the bug Right-to-Left scripts (Arabic, Hebrew, etc.) are not treated as RTL.

To Reproduce Type this string into Notepads:

العربية

This is the word “Arabic” in Arabic, contains 7 letters:

  • ا Alif;
  • ل Lam;
  • ع Ayin;
  • د Ra;
  • ب Ba;
  • ي Ya;
  • ة Ta Marbutah.

Expected behavior This string is shown like this: image It arranges the letters from right to left, and shows:

  • Alif in initial-isolated form;
  • Lam in initial form;
  • Ayin in medial form;
  • Ra in final form;
  • Ba in initial form;
  • Ya in medial form;
  • Ta Marbutah in final form;

Screenshots image It could be observed that this word is treated as left-to-right and then shaped together. Currently it is shown like this, which is wrong:

  • Alif and Lam shown in a Lam-Alif ligature in its final form;
  • Ayin in initial form;
  • Ra in final form;
  • Ba in medial form;
  • Ya in initial form;
  • Ta Marbutah in isolated form.

Desktop (please complete the following information):

  • OS: 18363.720
  • Version: 1.1.7.0

Additional context Please note that BiDi is not only supporting text that flows from right to left, but also the mixture of LTR and RTL scripts, and various BiDi control characters. Please refer to here for more detail: https://en.wikipedia.org/wiki/Bidirectional_text

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
be5inviscommented, Mar 30, 2020

image

Test String:

Adlam:	𞤑𞤵𞥅𞤤𞤢𞤤 𞤺𞤢𞤣𞤢𞤲𞤢𞤤 𞤋𞤲𞥆𞤢𞤥𞤢 𞤢𞥄𞤣𞤫𞥅𞤶𞤭 𞤬𞤮𞤬 𞤨𞤮𞤼𞤭⹁ 𞤲'𞤣𞤭𞤥𞤯𞤭𞤣𞤭 𞤫 𞤶𞤭𞤦𞤭𞤲𞤢𞤲𞥆𞤣𞤫 𞤼𞤮 𞤦𞤢𞤲𞥆𞤺𞤫 𞤸𞤢𞤳𞥆𞤫𞥅𞤶𞤭.
Arabic:	عندما يريد العالم أن ‪يتكلّم ‬ ، فهو يتحدّث بلغة يونيكود. تسجّل الآن لحضور المؤتمر الدولي العاشر ليونيكود (Unicode Conference)، الذي سيعقد في 10-12 آذار 1997 بمدينة مَايِنْتْس، ألمانيا.
Hebrew:	סעיף א. כל בני אדם נולדו בני חורין ושווים בערכם ובזכויותיהם. כולם חוננו בתבונה ובמצפון, לפיכך חובה עליהם לנהוג איש ברעהו ברוח של אחוה.
N'ko:		ߞߏ ߡߍ߲ ߞߵߊ߬ ߞߍ߫ ߊ߲ ߛߋ߫ ߘߊ߫ ߞߊ߬ ߕߟߋ߬ߓߊ߰ߓߟߐߟߐ ߘߊߦߟߍ߬ ߒߞߏ ߦߋ߫ ߸ 
Syriac:	ܫܠܡ ܘܠܐܠܗܐ ܏ܫܘܒ܆ ܘܠܕܘܝܐ ܕܣܡ ܗܠܝܢ ܫܘܒܩܢܐ܀
Thaana:	ވަނަ މާއްދާ ހުރިހާ އިންސާނުންވެސް ދުނިޔެއަށް އުފަންވަނީ، މިނިވަންކަމުގައި، ހަމަހަމަ ޙައްޤުތަކަކާއެކު، ހަމަހަމަ ދަރަޖައެއްގައި ކަމޭހިތެވިގެންވާ ބައެއްގެ ގޮތުގައެވެ.
1reaction
be5inviscommented, Mar 30, 2020

Slightly modifying PastePlainTextFromWindowsClipboard could fix the IME-paste issue:

Document.BeginUndoGroup();
Document.Selection.SetText(TextSetOptions.None, text);
Document.Selection.CharacterFormat.TextScript = TextScript.Ansi;
Document.Selection.StartPosition = Document.Selection.EndPosition;
Document.EndUndoGroup();
Read more comments on GitHub >

github_iconTop Results From Across the Web

Words get shifted when Copying and Pasting Arabic Text
When I do an edit>Copy>Paste a line of "Arabic Text" from a page on the net - upon pasting, the words in Arabic...
Read more >
Arabic text is correct direction, but period goes to the right ...
Arabic text is correct direction, but period goes to the right, not left at end of sentence.
Read more >
Copy/paste Arabic Text & Exporting Error : r/indesign
I'm having to copy and paste a text in Arabic, but no matter what the text will not place the periods correctly. Arabic...
Read more >
Arabic and Persian are formatted from left to right instead of ...
Issue Type: Bug Simply create a print statement and copy and paste Arabic or Persian text into that print statement.
Read more >
Issue in copying Arabic text from browser to our software
Hello Team, When I copy and paste Arabic text from browser to for example NotePad/our software, the exclamation mark order is reversed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found