5

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' rendeering

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

morten.c
  • 3,414
  • 5
  • 40
  • 45
René Nyffenegger
  • 39,402
  • 33
  • 158
  • 293

2 Answers2

8

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)
Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
0

Try adding the following attributes to your HTML:

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

<body dir="rtl">...
Nisse Engström
  • 4,738
  • 23
  • 27
  • 42
David Gidony
  • 1,243
  • 3
  • 16
  • 31
  • Are you sure the backslashes are needed and the tag has to follow the

    tag?

    – René Nyffenegger Sep 16 '14 at 16:29
  • hi, the backlashes are surely needed because the " signs are part of the HTML code. about the

    (that stands for paragraph) is just to format the text better. but that is not mandatory .

    – David Gidony Sep 17 '14 at 07:49