On Tue, 6 Mar 2007, Web Developer wrote:

> Seems like the content I want to use for right to left language isnt
> working in the title tag.

The problem is difficult to analyze, and it was particularly difficult at 
first to me, since by email program displayed the Arabic letters as 
spaces, so the problem looked very different (or nonexistent).

When non-ASCII characters are involved, it's generally best to post the 
URL of a demo page, rather than a copy of its content, even if it is very 
short.

> Both FF2 and IE7 goof on the title tag. although FF2 displays the
> title tag correctly in the 'tab' bar, but not in main browser address
> bar. Weird.

The way I see it, the situation is this: You have a string of Arabic 
letters, interspersed with spaces, and followed by a number in common 
("Arabic-Indic") digits, "1299". By Unicode rules, it is to be rendered so 
that the Arabic letters run from right to left, and the string "1299" 
appears on the left of them, with digits running from left to right. This 
is based on the inherent directionality of characters, as defined in the 
Unicode character database. Both IE 7 and Firefox 2 (and probably many 
earlier versions as well) implement this correctly, even in the absence of 
the dir attribute. (That attribute sets the direction of directionally 
neutral text, but here we deal with characters with strong directionality 
and spaces between them.) However, people who have encountered browser 
bugs in some situations recommend that the dir attribute be used anyway, 
even when it is redundant.

The problem you are described seems to be a problem of _truncation_. I'm 
puzzled, though, since what I see is correct rendering in the top bar of 
the browser window (the bar where you see the document's title and the 
name of the browser), whereas the truncated title text in a tab bar or in 
the browser window icon at the bottom of screen (when the window is 
minimized) is wrong in the sense that the ellipsis symbol "..." is on the
left, but it should be on the right (since the text runs from right to 
left and is truncated on the left. This also happens for the top bar, if I 
make the browser window narrow enough.

It seems that the position of the ellipsis can be fixed using
U+202B RIGHT-TO-LEFT EMBEDDING at the start of the title text and
U+202C POP DIRECTIONAL FORMATTING at its end.
<title>&#x202a;The title proper&#x202c;</title>

In theory, you could do the same in CSS by saying

title { unicode-bidi: embed; direction: rtl; }

but I wasn't surprised at all when I saw that it doesn't work. The title 
element's content is really a plain text string to be displayed outside 
the context of HTML and thus independently of CSS rules. Well, that's what 
browsers do; they could do otherwise.

> The Year "1299" should be last thing u see on left hand side.

Truncation normally means omitting characters from the _end_ of a string.
So I'm puzzled. The truncation, when applied, is under the control of the 
browser, of course, and I think some browsers use "middle truncation" 
(showing the start and the end and "..." between them) in some contexts. 
But there's nothing we can do about that in CSS.

> Sorry if this
> question is a bit off-topic as i am pretty sure its a html question
> and not css (unless u guys prefer to use css's direction/bidi-override
> properties which I heard are not too good).

In principle, it's quite on-topic, since the directionality of text on web 
pages can be affected in three ways:
- HTML markup (dir attribute and <bdo> tag)
- CSS rules (direction and unicode-bidi properties)
- character level (Unicode control characters for directionality,
   such as U+202B and U+202C).

In practice, the relevant CSS rules work well on reasonably new browsers
for document content, though it is debatable whether such things should be 
handled at the presentational level and not in HTML (or character level). 
However, title element rendering takes place outside any normal rendering 
rules, so it's immune to CSS (and HTML markup, since no tags are allowed 
in <title> element content)

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to