XRI Syntax Specification : 2.3.2 Escaping Rules for XRI Syntax : 俺約/俺メモ

 

2.3.2 Escaping Rules for XRI Syntax

This section defines rules for preventing misinterpretation of XRI syntax when an XRI reference is evaluated by a non-XRI-aware parser.

The first rule deals with cross-references as explained in section 2.2.2. Since a cross-reference contains either an IRI or an XRI reference (which itself may contain further nested IRIs or XRI references), it may include characters that, if not escaped, would cause misinterpretation when the XRI reference is used in a context that expects an IRI or URI reference. (最初のルールは2.2.2のクロスリファレンス。クロスリファレンスはIRI参照やXRI参照(これはさらにネストされたIRI参照やXRI参照を含むかも)を含むので、エスケープされていないのであれば、XRI参照がIRI/URI参照を期待したコンテキストで使われると誤解されるかも)

Consider the following XRI:

xri://@example/(xri://@example2/abc?id=1)

The generic parsing algorithm described in [URI] would separate the above XRI into the following components:

scheme = xri

authority = @example

path = /(xri://@example2/abc

query = id=1)

The desired separation is:

scheme = xri

authority = @example

path = /(xri://@example2/abc?id=1)

query = <undefined>

To avoid this type of misinterpretation, certain characters in a cross-reference must be percent-encoded when transforming an XRI reference into IRI-normal form. In particular, the question mark (“?”) character must be percent-encoded as “%3F” and the number sign “#” character must be percent-encoded as “%28”. (このように誤解しないためにはクロスリファレンスの文字によってはXRI参照をIRIノーマル形式に変換するときにパーセントエンコードしなければならない。クエスチョンマークキャラクタは"%3F"、サインキャラクタは"%28")

Following this rule, the above example would be expressed as:

xri://@example/(xri://@example2%3Fid=1)

In addition, the slash “/” character in a cross-reference may also be misinterpreted by a non-XRI-aware parser. Consider: (さらにスラッシュキャラクタはXRI実装していないパーサーによって誤解されうる)

xri://@example.com/(@example/abc)

If this were used as a base URI as defined in section 5 of [URI], the algorithm described in section 5.2 of [URI] would append a relative-path reference to:

xri://@example.com/(@example/

instead of the intended:

xri://@example.com/

This is because the “merge” algorithm in section 5.2.3 of [URI] is defined in terms of the last (right-most) slash character. This problem is avoided by encoding slashes within cross-references as “%2F”. (なぜならば最後のスラッシュ文字に”マージ"アルゴリズムが定義されているからです。"%2F"を使って防ぎます)

Following this rule, the above example would be expressed as:

xri://@example.com/(@example%2Fabc)

Ambiguity is also possible if an XRI reference in XRI-normal form contains characters that have been percent-encoded to indicate that they should not be interpreted as delimiters. For example, consider the following XRI in XRI-normal form:

xri://@example.com/(@example/abc%2Fd/ef)

This slash character between “c” and “d” is percent-encoded to show that it’s not a syntactical element of the XRI, i.e., that it should be interpreted as data and not as a delimiter. To preserve this type of distinction when converting an XRI reference to an IRI reference, the percent “%” character must be percent-encoded as “%25”. Following this rule, the above example fully converted would be:

xri://@example.com/(@example%2Fabc%252Fd%2Fef)

To summarize, the following four special rules MUST be applied during step 4 of section 2.3.1. Before applying these rules, the XRI reference MUST be in XRI-normal form and all IRIs in cross-references MUST be in a percent-encoded form appropriate to their schemes.

  1. Percent-encode all percent “%” characters as “%25” across the entire XRI reference.
  2. Percent-encode all number sign “#” characters that appear within a cross-reference as “%23”.
  3. Percent-encode all question mark “?” characters that appear within a cross-reference as “%3F”.
  4. Percent-encode all slash “/” characters that appear within a cross-reference as “%2F”.

XRI Syntax Specification

カテゴリー: 未分類 パーマリンク

XRI Syntax Specification : 2.3.2 Escaping Rules for XRI Syntax : 俺約/俺メモ への1件のフィードバック

  1. Unknown より:

    Hi,Do you have used LCDs, second hand LCDs, used flat screens and used LCD monitors? Please go here:www.sstar-hk.com(Southern Stars).We are constantly buying re-usable LCD panels and working for LCD recycling.The re-usable panels go through strictly designed process of categorizing, checking, testing, repairing and refurbishing before they are re-used to make remanufactured LCD displays and TV sets.Due to our recent breakthrough in testing and repairing technology of LCD, we can improve the value for your LCD panels.
    website:www.sstar-hk.com[cbbehagehcedif]

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中