title: How to solve BiDi bracket issues?
body: <p>As you might know some languages are written/read from right to left and we are trying to support some RTL languages. For the web UI using dir="rtl" in html does most of the job thanks to algorithms that browsers have. But I came across this issue with brackets in text:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;Bracket problems with BiDi&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;p style="direction: rtl;"&gt;Bracket problem: hello (world):&lt;/p&gt;
  &lt;p style="direction: rtl;"&gt;No bracket problem: hello (world) something:&lt;/p&gt;
  &lt;p style="direction: rtl;"&gt;Bracket problem: (السلام (عليكم &lt;/p&gt;
  &lt;p style="direction: rtl;"&gt;No bracket problem: السلام (عليكم) عليكم &lt;/p&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Problem can be seen here:</p>
  
  <p><a href="https://i.stack.imgur.com/zJocd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zJocd.png" alt="enter image description here"></a></p>
  
  <p>So I want that last bracket stay in the end. What would be your solution?</p>