source: draft-ietf-iri-3987bis/draft-ietf-iri-bidi-guidelines.xml @ 125

Last change on this file since 125 was 125, checked in by duerst@…, 7 years ago

fixed address of first author (material fixes as well as adding non-ASCII data)

File size: 22.0 KB
1<?xml version="1.0"?>
2<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
3<!ENTITY rfc2119 SYSTEM "">
4<!ENTITY rfc3490 SYSTEM "">
5<!ENTITY rfc3491 SYSTEM "">
6<!ENTITY rfc3987 SYSTEM "">
8<?rfc strict='yes'?>
10<?xml-stylesheet type='text/css' href='rfc2629.css' ?>
11<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
12<?rfc symrefs='yes'?>
13<?rfc sortrefs='yes'?>
14<?rfc iprnotified="no" ?>
15<?rfc toc='yes'?>
16<?rfc compact='yes'?>
17<?rfc subcompact='no'?>
18<rfc ipr="pre5378Trust200902" docName="draft-ietf-iri-bidi-guidelines-03"
19  category="bcp" xml:lang="en">
20  <front>
21    <title abbrev="Bidi IRI Guidelines">Guidelines for Internationalized
22      Resource Identifiers with Bi-directional Characters (Bidi IRIs)</title>
23    <author initials="M.J." isurname="Dürst" surname="Duerst" ifullname="Martin J. Dürst" fullname="Martin J. Duerst (Note: Please write &quot;Duerst&quot; with u-umlaut wherever possible, for example as &quot;D&amp;#252;rst&quot; in XML and HTML.)">
24      <organization>Aoyama Gakuin University<ionly> (青山学院大学)</ionly> </organization>
25      <address>
26        <postal>
27          <street>5-10-1 Fuchinobe</street>
28          <street>Chuo-ku</street>
29          <city>Sagamihara</city>
30          <region>Kanagawa</region>
31          <code>252-5258</code>
32          <country>Japan</country>
33        </postal>
34        <phone>+81 42 759 6329</phone>
35        <facsimile>+81 42 759 6495</facsimile>
36        <email></email>
37        <uri><aonly> (Note: This is the percent-encoded form of an IRI)</aonly><ionly>ürst/</ionly></uri>
38      </address>
39    </author>
40    <author initials="L." surname="Masinter" fullname="Larry Masinter">
41      <organization>Adobe</organization>
42      <address>
43        <postal>
44          <street>345 Park Ave</street>
45          <city>San Jose</city>
46          <region>CA</region>
47          <code>95110</code>
48          <country>U.S.A.</country>
49        </postal>
50        <phone>+1-408-536-3024</phone>
51        <email></email>
52        <uri></uri>
53      </address>
54    </author>
55    <author initials="A." surname="Allawi" fullname="Adil Allawi">
56      <organization>Diwan Software Limited</organization>
57      <address>
58        <postal>
59          <street>37-39 Peckham Road</street>
60          <city>London</city>
61          <code>SE5 8UH</code>
62          <country>United Kingdom</country>
63        </postal>
64        <phone>+44 7718 785850</phone>
65        <facsimile>+44 20 72525444</facsimile>
66        <email></email>
67        <uri></uri>
68      </address>
69    </author>
70    <date year="2012" month="March" day="13"/>
71    <area>Applications</area>
72    <workgroup>Internationalized Resource Identifiers (iri)</workgroup>
73    <keyword>IRI</keyword>
74    <keyword>Internationalized Resource Identifier</keyword>
75    <keyword>BIDI</keyword>
76    <keyword>URI</keyword>
77    <keyword>URL</keyword>
78    <keyword>IDN</keyword>
79    <abstract>
80      <t>This specification gives guidelines for selection, use, and
81        presentation of International Resource Identifiers (IRIs) which include
82        characters with inherent right-to-left (rtl) writing direction. </t>
83    </abstract>
84  </front>
85  <middle>
86    <section title="Introduction">
87      <t>Some UCS characters, such as those used in the Arabic and Hebrew
88        scripts, have an inherent right-to-left (rtl) writing direction as
89        opposed to characters, such as those in Latin scripts, that have an
90        inherent left-to-right (ltr) direction. IRIs containing rtl characters
91        (called bidirectional IRIs or Bidi IRIs) require additional attention
92        because of the non-trivial relation between their logical and visual
93        ordering. The logical order represents the order in which characters are
94        stored on computers and read by people. The visual order is the order in
95        which the characters appear (or are expected to appear) on a computer
96        display or printout.</t>
97      <t>Generally, alphabetic characters in scripts like Arabic and Hebrew are
98        drawn rtl while numbers are drawn ltr. Symbols, such as slash '/' and
99        period '.' take their visual direction from the surrounding chracters.</t>
100      <t>Because of this complex interaction between the logical representation,
101        the visual representation, and the syntax of a Bidi IRI, a balance is
102        needed between various requirements. The main requirements are: <list
103        style="hanging">
104        <t hangText="1.">user-predictable conversion between visual and logical
105          representation;</t>
106        <t hangText="2.">the ability to include a wide range of characters in
107          various parts of the IRI; and</t>
108        <t hangText="3.">minor or no changes or restrictions for
109          implementations.</t>
110        </list></t>
111      <section title="Notation">
112        <t>In this document, "Bidi Notation" is used for the given Bidi IRI
113          examples as follows: Lower case letters a-z stand for characters that
114          are written with a left to right ordering (such as Latin characters),
115          whereas upper case letters A-Z represent characters that are written
116          right to left (such as Arqbic or Hebrew characters). Numbers and
117          symbols are the same.</t>
118        <t> In this document, the key words "MUST", "MUST NOT", "REQUIRED",
120          and "OPTIONAL" are to be interpreted as described in <xref
121            target="RFC2119"/>.</t>
122      </section>
123      <!-- Notation -->
124    </section>
125    <!-- Introduction -->
126    <section title="Logical Storage and Visual Presentation" anchor="visual">
127      <t>When stored or transmitted in digital representation, Bidi IRIs MUST be
128        in full logical order and MUST conform to the IRI syntax rules (which
129        includes the rules relevant to their scheme). This ensures that
130        Bidi IRIs can be processed in the same way as other IRIs.</t>
131      <t>Bidi IRIs MUST be visually ordered by the Unicode Bidirectional
132        Algorithm <xref target="UNIV6"/>, <xref target="UNI9"/>. Bidi IRIs MUST
133        be rendered in the same way as they would be if they were in a
134        left-to-right embedding. </t>
135      <t>In conformance with the Unicode Bidirectional Algorithm, embedding MAY
136        be done in one of two ways: <list style="hanging">
137        <t hangText="1.">precede the IRI with U+202A, LEFT-TO-RIGHT EMBEDDING
138          (LRE), and follow with U+202C, POP DIRECTIONAL FORMATTING (PDF);
139          or</t>
140        <t hangText="2.">use a higher-level protocol (e.g., the dir='ltr'
141          attribute in HTML).</t>
142        </list></t>
143      <t>Preceding and following the Bidi IRI with U+200E, LEFT-TO-RIGHT MARK
144        (LRM). Is NOT RECOMMENDED as, there are cases where this may not be
145        sufficient to match full left to right embedding.</t>
146      <t>There is no requirement to use embedding if the display is still the
147        same without the embedding. For example, a Bidi IRI in a text
148        with left-to-right base directionality (such as used for English or
149        Cyrillic) that is preceded and followed by whitespace and strong
150        left-to-right characters does not need an embedding. Also, a
151        bidirectional relative IRI reference that only contains strong
152        right-to-left characters and weak characters (such as symbols) and that
153        starts and ends with a strong right-to-left character and appears in a
154        text with right-to-left base directionality (such as used for Arabic or
155        Hebrew) and is preceded and followed by whitespace and strong characters
156        does not need an embedding.</t>
157      <t>However, Implementers are, RECOMMENDED to use embedding in all cases
158        where they are not completely sure that the display behavior is
159        unaffected without the embedding.</t>
160      <t>The Unicode Bidirectional Algorithm (<xref target="UNI9"/>, section
161        4.3) permits higher-level protocols to influence bidirectional
162        rendering. Such changes by higher-level protocols MUST NOT be used if
163        they change the rendering of IRIs.</t>
164      <t>The bidirectional formatting characters that may be used before or
165        after the IRI to ensure correct display are not themselves part of the
166        IRI. IRIs MUST NOT contain bidirectional formatting characters (LRM,
167        RLM, LRE, RLE, LRO, RLO, and PDF). They affect the visual rendering of
168        the IRI but do not appear themselves. It would therefore not be possible
169        to input an IRI with such characters correctly.</t>
170    </section>
171    <!-- visual -->
172    <section title="Bidi IRI Structure" anchor="bidi-structure">
173      <t>The Unicode Bidirectional Algorithm is designed for general purpose
174        text. To make sure that it does not affect the rendering of Bidi IRIs
175        outside of the requirements of this document, some restrictions on Bidi
176        IRIs are necessary. These restrictions are given in terms of delimiters
177        (structural characters, mostly punctuation such as "@", ".", ":", and
178        "/") and components (usually consisting mostly of letters and
179        digits).</t>
180      <t>The following syntax rules from the ABNF of <xref target="RFC3987bis"/>
181        correspond to components for the purpose of Bidi behavior: iuserinfo,
182        ireg-name, isegment, isegment-nz, isegment-nz-nc, ireg-name, iquery, and
183        ifragment.</t>
184      <t>Specifications that define the syntax of any of the above components
185        MAY divide them further and define smaller parts to be components
186        according to this document. As an example, the restrictions of <xref
187          target="RFC3490"/> on bidirectional domain names correspond to treating
188        each label of a domain name as a component for schemes with ireg-name as
189        a domain name. Even where the components are not defined formally, it
190        may be helpful to think about some syntax in terms of components and to
191        apply the relevant restrictions. For example, for the usual name/value
192        syntax in query parts, it is convenient to treat each name and each
193        value as a component. As another example, the extensions in a resource
194        name can be treated as separate components.</t>
195      <t>For each component, the following restrictions apply:</t>
196      <t> <list style="hanging">
197        <t hangText="1.">A component SHOULD NOT use both right-to-left and
198          left-to-right characters.</t>
199        <t hangText="2.">A component using right-to-left characters SHOULD start
200          and end with right-to-left characters.</t>
201      </list></t>
202      <t>The above restrictions are given as "SHOULD"s, rather than as "MUST"s.
203        For IRIs that are never presented visually, they are not relevant.
204        However, for IRIs in general, they are very important to ensure
205        consistent conversion between visual presentation and logical
206        representation, in both directions.</t>
207      <t><list style="hanging">
208        <t hangText="Note:">In some components, the above restrictions may
209          actually be strictly enforced. For example, <xref target="RFC3490"/>
210          requires that these restrictions apply to the labels of a host name
211          for those schemes where ireg-name is a host name. In some other
212          components (for example, path components) following these restrictions
213          may not be too difficult. For other components, such as parts of the
214          query part, it may be very difficult to enforce the restrictions
215          because the values of query parameters may be arbitrary character
216          sequences.</t>
217      </list></t>
218      <t>If the above restrictions cannot be satisfied otherwise, the affected
219        component can always be mapped to URI notation using the general
220        percent-encoding of IRI components, as described in <xref
221          target="RFC3987bis"/>. Please note that the whole component has to be
222        mapped (see also Example 9 below).</t>
223    </section>
224    <!-- bidi-structure -->
225    <section title="Input of Bidi IRIs" anchor="bidiInput">
226      <t>Bidi input methods MUST generate Bidi IRIs in logical order while
227        rendering them according to <xref target="visual"/>. During input,
228        rendering SHOULD be updated after every new character is input to avoid
229        end-user confusion.</t>
230    </section>
231    <!-- bidiInput -->
232    <section title="Examples">
233      <t>This section gives examples of Bidi IRIs in Bidi Notation. It shows
234        legal IRIs with the relationship between their logical and visual
235        representation and explains how certain phenomena in this relationship
236        may look strange to somebody not familiar with bidirectional behavior,
237        but familiar to users of Arabic and Hebrew. It also shows what happens
238        if the restrictions given in <xref target="bidi-structure"/> are not
239        followed. The examples below can be seen at <xref target="BidiEx"/>, in
240        Arabic, Hebrew, and Bidi Notation variants.</t>
241      <t>To read the bidi text in the examples, read the visual representation
242        from left to right until you encounter a block of rtl text. Read the rtl
243        block (including slashes and other special characters) from right to
244        left, then continue at the next unread ltr character.</t>
245      <t>Example 1: A single component with rtl characters is inverted:
246        <vspace/>Logical representation:
247        "http://ab.CDEFGH.ij/kl/mn/op.html"<vspace/>Visual representation:
248        "http://ab.HGFEDC.ij/kl/mn/op.html"<vspace/>Components can be read one
249        by one, and each component can be read in its natural direction.</t>
250      <t>Example 2: More than one consecutive component with rtl characters is
251        inverted as a whole: <vspace/>Logical representation:
252        "http://ab.CDE.FGH/ij/kl/mn/op.html"<vspace/>Visual representation:
253        "http://ab.HGF.EDC/ij/kl/mn/op.html"<vspace/> A sequence of rtl
254        components is read rtl, in the same way as a sequence of rtl words is
255        read rtl in a bidi text.</t>
256      <t>Example 3: All components of an IRI (except for the scheme) are rtl.
257        All rtl components are inverted overall: <vspace/>Logical
258        representation: "http://AB.CD.EF/GH/IJ/KL?MN=OP;QR=ST#UV"<vspace/>Visual
259        representation: "http://VU#TS=RQ;PO=NM?LK/JI/HG/FE.DC.BA"<vspace/> The
260        whole IRI (except the scheme) is read rtl. Delimiters between rtl
261        components stay between the respective components; delimiters between
262        ltr and rtl components don't move.</t>
263      <t>Example 4: Each of several sequences of rtl components is inverted on
264        its own: <vspace/>Logical representation:
265        "http://AB.CD.ef/gh/IJ/KL.html"<vspace/>Visual representation:
266        "http://DC.BA.ef/gh/LK/JI.html"<vspace/> Each sequence of rtl components
267        is read rtl, in the same way as each sequence of rtl words in an ltr
268        text is read rtl.</t>
269      <t>Example 5: Example 2, applied to components of different kinds:
270        <vspace/>Logical representation: ""
271        <vspace/>Visual representation: ""<vspace/>
272        The inversion of the domain name label and the path component may be
273        unexpected, but it is consistent with other bidi behavior. For
274        reassurance that the domain component really is "", it may be
275        helpful to read aloud the visual representation following the Unicode
276        Bidirectional Algorithm. After "" one reads the RTL block
277        "E-F-slash-G-H", which corresponds to the logical representation. </t>
278      <t>Example 6: Same as Example 5, with more rtl components:
279        <vspace/>Logical representation:
280        "http://ab.CD.EF/GH/IJ/kl.html"<vspace/>Visual representation:
281        "http://ab.JI/HG/FE.DC/kl.html"<vspace/> The inversion of the domain
282        name labels and the path components may be easier to identify because
283        the delimiters also move.</t>
284      <t>Example 7: A single rtl component includes digits: <vspace/>Logical
285        representation: "http://ab.CDE123FGH.ij/kl/mn/op.html"<vspace/>Visual
286        representation: "http://ab.HGF123EDC.ij/kl/mn/op.html"<vspace/> Numbers
287        are written ltr in all cases but are treated as an additional embedding
288        inside a run of rtl characters. This is completely consistent with usual
289        bidirectional text.</t>
290      <t>Example 8 (not allowed): Numbers are at the start or end of an rtl
291        component:<vspace/>Logical representation:
292        ""<vspace/>Visual representation:
293        ""<vspace/> The sequence "1/2" is
294        interpreted by the Bidirectional Algorithm as a fraction, fragmenting the
295        components and leading to confusion. There are other characters that are
296        interpreted in a special way close to numbers; in particular, "+", "-",
297        "#", "$", "%", ",", ".", and ":".</t>
298      <t>Example 9 (not allowed): The numbers in the previous example are
299        percent-encoded: <vspace/>Logical representation:
300        "",<vspace/>Visual representation:
301        ""</t>
302      <t>Example 10 (allowed but not recommended): <vspace/>Logical
303        representation: "http://ab.CDEFGH.123/kl/mn/op.html"<vspace/>Visual
304        representation: "http://ab.123.HGFEDC/kl/mn/op.html"<vspace/> Components
305        consisting of only numbers are allowed (it would be rather difficult to
306        prohibit them), but these may interact with adjacent RTL components in
307        ways that are not easy to predict.</t>
308      <t>Example 11 (allowed but not recommended): <vspace/>Logical
309        representation: "http://ab.CDEFGH.123ij/kl/mn/op.html"<vspace/>Visual
310        representation: "http://ab.123.HGFEDCij/kl/mn/op.html"<vspace/>
311        Components consisting of numbers and left-to-right characters are
312        allowed, but these may interact with adjacent RTL components in ways
313        that are not easy to predict.</t>
314    </section>
315    <!-- examples -->
316    <section title="IANA Considerations" anchor="iana">
317      <t>This document makes no changes to IANA registries.</t>
318    </section>
319    <!-- IANA -->
320    <section title="Security Considerations" anchor="security">
321      <t>Confusion can occur with bidirectional IRIs, if the restrictions in
322        <xref target="bidi-structure"/> are not followed. The same visual
323        representation may be interpreted as different logical representations,
324        and vice versa. It is also very important that a correct Unicode
325        bidirectional implementation be used.</t>
326    </section>
327    <!-- security -->
328    <section title="Acknowledgements">
329      <t>This document was derived from <xref target="RFC3987"/> and <xref
330        target="RFC3987bis"/> and the acknowledgments of those documents
331        apply.</t>
332    </section>
333    <!-- acknowledgements -->
334  </middle>
335  <back>
336    <references title="Normative References">
337      <reference anchor="RFC3987bis"
338        target="">
339        <front>
340          <title>Internationalized Resource Identifiers (IRIs)</title>
341          <author initials="M." surname="Duerst"/>
342          <author initials="L." surname="Masinter" fullname="Larry Masinter"/>
343          <author initials="M." surname="Suignard"/>
344          <date year="2011" month="August" day="14"/>
345        </front>
346      </reference>
347      <reference anchor="ASCII">
348        <front>
349          <title>Coded Character Set -- 7-bit American Standard Code for
350            Information Interchange</title>
351          <author>
352            <organization>American National Standards Institute</organization>
353          </author>
354          <date year="1986"/>
355        </front>
356        <seriesInfo name="ANSI" value="X3.4"/>
357      </reference>
358      <reference anchor="ISO10646">
359        <front>
360          <title>ISO/IEC 10646:2003: Information Technology - Universal
361            Multiple-Octet Coded Character Set (UCS)</title>
362          <author>
363            <organization>International Organization for
364              Standardization</organization>
365          </author>
366          <date month="December" year="2003"/>
367        </front>
368        <seriesInfo name="ISO" value="Standard 10646"/>
369      </reference> &rfc2119; &rfc3490; &rfc3491; <reference anchor="UNIV6">
370        <front>
371          <title>The Unicode Standard, Version 6.0.0 (Mountain View, CA, The
372            Unicode Consortium, 2011, ISBN 978-1-936213-01-6)</title>
373          <author>
374            <organization>The Unicode Consortium</organization>
375          </author>
376          <date year="2010" month="October"/>
377        </front>
378      </reference>
379      <reference anchor="UNI9"
380        target="">
381        <front>
382          <title>The Unicode Bidirectional Algorithm</title>
383          <author initials="M." surname="Davis" fullname="Mark Davis">
384            <organization/>
385          </author>
386          <date year="2004" month="March"/>
387        </front>
388        <seriesInfo name="Unicode Standard Annex" value="#9"/>
389      </reference>
390    </references>
391    <references title="Informative References">
392      <reference anchor="BidiEx"
393        target="">
394        <front>
395          <title>Examples of Bidi IRIs</title>
396          <author>
397            <organization/>
398          </author>
399          <date year="" month=""/>
400        </front>
401      </reference> &rfc3987; </references>
402  </back>
Note: See TracBrowser for help on using the repository browser.