RFC4287 currently has no *efficient* means of indicating the base directionality of text. While the Unicode bidi control characters can be used, they can be problematic to use correctly within XML and do not allow publishers to set a single default direction for a complete Atom document.

This proposal adds a new common attribute to all Atom elements called "dir". The attribute is optional and has three possible values, "ltr", "rtl" and "" (representing 'unspecified'). If the attribute is missing, the value is considered to be unspecified. This should make the element fully backwards compatible with existing compliant RFC4287 implementations that properly handle "unknown markup".

This proposal does add the requirement that bidi text in atom docs MUST be rendered using the unicode bidi algorithm but makes it clear that the use of dir on an element does not necessarily open a new level of embedding... meaning that feed consumers have the responsibility of determining how to apply the bidi algorithm based on how those consumers choose to display the text (e.g. some readers may display entry content in a <div> while others may display content in a <span>, both of which handle bidi text differently depending on context).

I also specify that bidi text in (x)html should use the bidi markup as defined by those specs.




(see abstract)


2.0 Add "dir" to atomCommonAttributes

   atomCommonAttributes =
      attribute xml:base { atomUri }?,
      attribute xml:lang { atomLanguageTag }?,
      attribute dir { "ltr" | "rtl" | "lro" | "rlo" | "" }?,

2.1 The "dir" Attribute

Any element defined by this specification MAY have a "dir" attribute whose content specifies 
the base direction of directionally-neutral text [UNICODE].  Possible values for the attribute 
are "ltr" and "rtl" indicating "left-to-right" and "right-to-left" respectively, "lro" and "rlo" 
indicating explicit "left-to-right" and "right-to-left" overrides, or an empty string "" indicating 
that no base-direction is unspecified.  If the "dir" attribute is not 
specified, the value is assumed to be an empty string.

The direction specified by "dir" applies only to elements and attributes whose values are 
specified as being "Language-Sensitive".  The attribute is inherited by descendent elements 
and may be overridden.

Example atom:feed with right-to-left directionality

  <?xml version="1.0" ?>
  <feed xmlns="" dir="rtl">

If an Atom document contains any right-to-left characters, the Unicode Bidirectional 
Algorithm [UAX#9] MUST be used to render that text. Because consumers of Atom documents 
vary broadly in the way they display text, the "ltr" and "rtl" values do not necessarily 
open an additional level of embedding with respect to the bidirectional algorithm. Consuming 
applications that render bidirectional text are responsible for determining the appropriate 
level of embedding.  The "lro" and "rlo" values are used to override the inherent directionality 
of characters as defined by [UNICODE].

When Atom Text Constructs or the atom:content elements contain bidirectional text and the type 
attribute is set to either "html" or "xhtml", the bidirectional markup mechanisms specific to 
each format SHOULD be used.

Example atom:feed with bidirectional XHTML

  <?xml version="1.0" ?>
  <feed xmlns="" dir="rtl">
    <title type="xhtml">
      <div xmlns="">
        <p dir="rtl">&#x0679&#x067A;&#x067B;</p>

The Unicode bidirectional control characters MAY also be used within attributes and element 
values to indicate the directionality of text.

IRI's containing bidirectional characters MUST be stored, transmitted and rendered as defined 
in [RFC3987] Section 4.