473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

dir=ltr/rtl

Occasionally I come across:

"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"
dir="ltr">

......and so I have a question or two where the w3c specs seem (to me) to
be a little bit vague on:

(a) Is the dir="ltr" really necessary? I.e. Does it serve any real
purpose in this context.

E.g. If I am a viewer whose native browser is set up to read Hebrew or
Arabic would I be correct in assuming that, if reading an
English-language page without 'dir=ltr', the page would still be
presented correctly -- in the same way that a Hebrew or Arabic page
(without a 'dir') is correctly presented (rtl) in my English-language
based browser?

(b) If it is presented correctly without the 'dir' (as seems to be the
case), how does the browser determine the direction (I believe that
browsers are not meant to rely on the 'lang' attribute to determine
this?). Is it a function of the encoding being used?

Any explanation gratefully received ;-)

Thanks..
--
Jake (ja**@gododdin.demon.co.uk -- just a 'spam trap' mail address)
Dec 1 '05 #1
5 10599
Jake wrote:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB"
dir="ltr">

.....and so I have a question or two where the w3c specs seem (to me) to
be a little bit vague on:
There's a lot of vagueness in them, but what do you mean in this context?
(a) Is the dir="ltr" really necessary?
No. The default value for dir is "ltr", see
http://www.w3.org/TR/html4/struct/di...locklevel-bidi
(The DTD does not say this, because an element by default _inherits the
dir setting from its parent, so the default dir="ltr" really applies to
the root element only.)

Note that this does not depend on the language (declared or real); if
you have <html lang="ar">, you still have dir="ltr".
I.e. Does it serve any real purpose in this context.
Other than being explicit, no.
E.g. If I am a viewer whose native browser is set up to read Hebrew or
Arabic would I be correct in assuming that, if reading an
English-language page without 'dir=ltr', the page would still be
presented correctly
Yes.
-- in the same way that a Hebrew or Arabic page
(without a 'dir') is correctly presented (rtl) in my English-language
based browser?
A correctly written Hebrew or Arabic page is represented correctly on
any correctly behaving browser, if the browser has a capability of
rendering Hebrew or Arabic characters. (There's no requirement that a
browser be capable of rendering all the possible characters.)

The writing direction primarily depends on the inherent directionality
of characters, not on the dir attribute, which specifies the direction
for directionally neutral characters (roughly speaking - it also affects
the directionality of table columns, the default alignment, etc.).
(b) If it is presented correctly without the 'dir' (as seems to be the
case), how does the browser determine the direction (I believe that
browsers are not meant to rely on the 'lang' attribute to determine
this?).
They have been explicitly told _not_ to use the 'lang' attribute _at
all_ for that. The default is dir="rtl", and right-to-left characters
run right to left independently of this.
Is it a function of the encoding being used?


No. (Well, there's "visual Hebrew" encoding which really means
backwards-written Hebrew, but just stay away from it, mm'kay?)
Dec 1 '05 #2
On Thu, 1 Dec 2005, Jake wrote:
Occasionally I come across:
dir="ltr">

(a) Is the dir="ltr" really necessary? I.e. Does it serve any real
purpose in this context.
No.
(b) If it is presented correctly without the 'dir' (as seems to be the
case), how does the browser determine the direction (I believe that
browsers are not meant to rely on the 'lang' attribute to determine
this?).
"dir=ltr" is the default value.
For "dir=rtl", read
http://ppewww.ph.gla.ac.uk/~flavell/...direction.html
and see the examples at
http://www.unics.uni-hannover.de/nht...onal-text.html
Is it a function of the encoding being used?


Only for "visual vs. logical Hebrew". But "visual Hebrew" is evil®
and should not be used anymore.

--
Evil® is a registered trademark of the President of the United States.

Dec 2 '05 #3
On Thu, 1 Dec 2005, Jake wrote:
(a) Is the dir="ltr" really necessary? I.e. Does it serve any real
purpose in this context.


One thing to stress is that the dir= attribute is defined to have no
effect on characters which possess an inherent directionality: the
only way to influence those is with a <bdo...> element.

The purpose of the dir= attribute is to resolve ambiguities which
occur when mixing rtl and ltr scripts: characters which have neutral
directionality could get positioned inappropriately if left to the
browser's own rules. We found that liberal use of the dir= attribute
when mixing directionality was a good way to get the desired results,
avoiding browser anomalies and, in some cases, bugs.

(The unicode rules for automatically resolving directionality
ambiguities are rather complex!).

You've already been pointed to
http://ppewww.ph.gla.ac.uk/~flavell/...direction.html

cheers
Dec 2 '05 #4
In message <Pi*******************************@ppepc56.ph.gla. ac.uk>,
Alan J. Flavell <fl*****@ph.gla.ac.uk> writes
On Thu, 1 Dec 2005, Jake wrote:
(a) Is the dir="ltr" really necessary? I.e. Does it serve any real
purpose in this context.
One thing to stress is that the dir= attribute is defined to have no
effect on characters which possess an inherent directionality: the
only way to influence those is with a <bdo...> element.

The purpose of the dir= attribute is to resolve ambiguities which
occur when mixing rtl and ltr scripts: characters which have neutral
directionality could get positioned inappropriately if left to the
browser's own rules. We found that liberal use of the dir= attribute
when mixing directionality was a good way to get the desired results,
avoiding browser anomalies and, in some cases, bugs.

(The unicode rules for automatically resolving directionality
ambiguities are rather complex!).

You've already been pointed to
http://ppewww.ph.gla.ac.uk/~flavell/...direction.html


Indeed I have, and most instructional it was. My thanks to you, Jukka,
and Andreas for your comments.

I raised the question following comments by someone in another forum who
keeps insisting that it's necessary 'to avoid potential problems with
browsers in far-off foreign parts' -- or words to that effect ;-)

As my IE6 browser seems to have no problem rendering Hebrew and Arabic
correctly (rtl) even though the (X)HTML pages have no explicit
directionality, I suspected that the 'dir=ltr/rtl' wasn't going to have
any effect on page as a whole.

The explanations given in this thread makes things a little clearer.
cheers


Regards.
--
Jake (ja**@gododdin.demon.co.uk -- just a 'spam trap' mail address)
Dec 3 '05 #5
On Sat, 3 Dec 2005, Jake wrote:
As my IE6 browser seems to have no problem rendering Hebrew and Arabic
correctly (rtl) even though the (X)HTML pages have no explicit
directionality,


Internet Explorer 6 does not implement the bidi algorithm
http://www.unicode.org/reports/tr9/ - at least not completely.
If you observe differences between Mozilla and IE 6, you can be
sure that IE is wrong. You find such examples on Alan's and my
pages. Other browsers (Opera, Konqueror), however, are even worse.

It is therefore a good idea to mark _every_ piece of text with
the DIR attribute when you have Arabic or Hebrew text in your page.

--
Netscape 3.04 does everything I need, and it's utterly reliable.
Why should I switch? Peter T. Daniels in <news:sci.lang>

Dec 5 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Alan J. Flavell | last post by:
It's not clear to me whether the bdo tag is supposed to also influence attribute values e.g titles on the bdo tag itself and/or on any enclosed tags. There have been suggestions for writing...
9
by: Theodore A. Jencks | last post by:
Hi All, I have a problem that is two fold. First a little about the enviroment I'm using; I am running Microsoft Windows XP with all security patches applied. I use Mozilla 1.6 for all testing...
39
by: WindAndWaves | last post by:
Hi Gurus I have a page, which looks a bit like this: .... <body> <div ID=id1>................</DIV> <div ID=gsd>................</DIV> <div ID=ewd>................</DIV> <div...
5
by: Andreas Prilop | last post by:
Normally it would be unnecessary to mark your HTML documents as "left-to-right" because "DIR=LTR" is the default value. http://ppewww.ph.gla.ac.uk/~flavell/charset/text-direction.html...
2
by: sirshurf | last post by:
Hi, I am using a phpmailer class to send some staff over the email... I am tring to send it with text/html but for some reason the email are been converted to plain and all the headers are shown,...
1
by: hime | last post by:
Hello every body I want to know if there is a way to set the direction of txt boxes in the web form to rtl without having to do so for each box by it self and I can't change the direction for the...
3
by: rednarjess | last post by:
Dear All; I have table in vehicle.php file that contains vehicle information(plate number, vehicle model, reg. and exp. dates). I pprovided each record with href(more) if he want to know more about...
12
by: Juan T. Llibre | last post by:
re: !I found an MSDN document that explains why what I'm trying to do should work Lee, From : http://www.w3.org/TR/REC-xml/ "A special attribute named xml:lang may be inserted in...
2
by: Shahid | last post by:
Hi, I am parsing an .HTML file that contains following example code: <div> <p class="html_preformatted" awml:style="HTML Preformatted" dir="ltr" style="text-align:left"><span...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.