Question

I have a html document that contains hebrew and latin text. It is encoded with utf-8:

<!DOCTYPE HTML>
<html>
<head>
  <title>Title</title>
  <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
</head>

<style type='text/css'> 
     .h  { color: green}
</style>

<body>

   <div>
      here are some words הנה כמה מילות (100, 200)
   </div>

   <div>
      here are some words <span class='h'>הנה כמה מילות</span> (100, 200)
   </div>

   <div>
      here are some words <span class='h'>הנה כמה מילות</span> <span>(100, 200)</span>
   </div>

   <div>
      here are some words <span class='h'>הנה כמה מילות</span> <b>WORD</b> <span>(100, 200)</span>
   </div>

</body>
</html>

The first three lines are not displayed as I think they should. The fourth (with the additional <b>WORD</b> in front of the parantheses is.

Here's how this document is displayed in Firefox:

Firefox

Edit Not even the copy/paste of my html text works correctly, so here's a screen shot of the original html (sorry, but it seems as though it's impossible to get this text rendered correctly):

enter image description here

Was it helpful?

Solution

When you have words in Latin and Hebrew letters mixed on the same page, the sequences of words are normally written properly due to the inherent directionality of characters. Hebrew passages run right to left.

But when characters like parentheses are involved, things get more complicated. Parentheses are directionally neutral (or utral) and participate in the direction of adjacent characters. Problems arise when they appear between Latin and Hebrew letters. A simple remedy is to use the LEFT-TO-RIGHT MARK character, representable in HTML as &lrm;, for example

here are some words <span class='h'>הנה כמה מילות</span> &lrm;(100, 200)

OTHER TIPS

Try adding the following attributes to your HTML:

<html><meta charset="UTF-8">......

<body dir="rtl">...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top