*6. Use of IRIs **6.1. Limitations on UCS Characters Allowed in IRIs > This section discusses limitations on characters and character sequences usable for IRIs beyond those given in section 2.2 and section 4.1. The considerations in this section are relevant when IRIs are created and when URIs are converted to IRIs. この章では [[IRI]] で使うことのできる[[文字]]や[[文字列]]についての 2.2節や4.1節の説明以上の制限について議論します。 この章の考察は [[IRI]] を作る時や [[URI]] を [[IRI]] に変換する時に関係します。 > a. The repertoire of characters allowed in each IRI component is limited by the definition of that component. For example, the definition of the scheme component does not allow characters beyond US-ASCII. [[IRI]] の各部品で認められる[[文字]]の[[レパートリ]]はその部品の定義により制限されます。 例えば、 [CODE(ABNF)[[[scheme]]]] 部品の定義は [CODE(charset)[[[US-ASCII]]]] 外の[[文字]]を認めていません。 > (Note: In accordance with URI practice, generic IRI software cannot and should not check for such limitations.) (注意: [[URI]] の慣習では一般の [[IRI]] ソフトウェアはこの種の制限を検査することはできませんし、 するべきでもありません。) > b. The UCS contains many areas of characters for which there are strong visual look-alikes. Because of the likelihood of transcription errors, these also should be avoided. This includes the full-width equivalents of Latin characters, half-width Katakana characters for Japanese, and many others. It also includes many look-alikes of "space", "delims", and "unwise", characters excluded in [RFC3491]. [[UCS]] には見た目がよく似た[[文字]]が多くあります。 そのような[[文字]]は転記時に誤りやすいので避けるべきです。 これには[[日本語]]で使う[[全角]]版の[[ラテン文字]]や[[半角]]の[[片仮名]]をはじめ、 他にも多くが含まれます。 [[RFC 3491]] で除外されているよく似た[Q[[[間隔]]]], [Q[区切]], [Q[賢くない]][[文字]]も含まれます。 > Additional information is available from [UNIXML]. [UNIXML] is written in the context of running text rather than in that of identifiers. Nevertheless, it discusses many of the categories of characters not appropriate for IRIs. 追加情報が [SRC[UNIXML]] から得られます。 [SRC[UNIXML]] は識別子ではなく普通の文章について書かれています。しかし、 [[IRI]] で不適切な[[文字]]の分類の多くについて議論しています。 **6.2. Software Interfaces and Protocols > Although an IRI is defined as a sequence of characters, software interfaces for URIs typically function on sequences of octets or other kinds of code units. Thus, software interfaces and protocols MUST define which character encoding is used. [[IRI]] は[[文字]]の列として定義されていますが、 [[URI]] のソフトウェア界面は[[オクテット列]]やその他の[[符号]]単位列に機能するのが普通です。 ですから、ソフトウェア界面やプロトコルは使用する[[文字符号化]]を定義しなければ'''なりません'''。 > Intermediate software interfaces between IRI-capable components and URI-only components MUST map the IRIs per section 3.1, when transferring from IRI-capable to URI-only components. This mapping SHOULD be applied as late as possible. It SHOULD NOT be applied between components that are known to be able to handle IRIs. [[IRI]] が使える部品と [[URI]] だけの部品の媒介となるソフトウェア界面は [[IRI]] が使える部品から [[URI]] だけの部品に転送する時は 3.1節に従って [[IRI]] を写像しなければ'''なりません'''。 この写像は可能な限り後の段階で適用する'''べきです'''。 [[IRI]] を扱うことができるとわかっている部品間で適用する'''べきではありません'''。 **6.3. Format of URIs and IRIs in Documents and Protocols > Document formats that transport URIs may have to be upgraded to allow the transport of IRIs. In cases where the document as a whole has a native character encoding, IRIs MUST also be encoded in this character encoding and converted accordingly by a parser or interpreter. IRI characters not expressible in the native character encoding SHOULD be escaped by using the escaping conventions of the document format if such conventions are available. Alternatively, they MAY be percent-encoded according to section 3.1. For example, in HTML or XML, numeric character references SHOULD be used. If a document as a whole has a native character encoding and that character encoding is not UTF-8, then IRIs MUST NOT be placed into the document in the UTF-8 character encoding. [[URI]] を輸送する[[文書]]書式は [[IRI]] を輸送できるように更新しなければならないかもしれません。 [[文書]]が全体として[[文字符号化]]が決められる場合には [[IRI]] もその[[文字符号化]]で[[符号化]]し、 構文解析器か解釈器でそれに従って変換しなければ'''なりません'''。 その文字符号化で表現できない [[IRI]] の[[文字]]は、 その文書書式に[[逃避]]表現法があれば、それを使って[[逃避]]する'''べきです'''。 代わりに3.1節に従って[[百分率符号化]]しても'''構いません'''。 例えば、 [[HTML]] や [[XML]] では[[数値文字参照]]を使う'''べきです'''。 [[文書]]が全体として[[文字符号化]]が決められる場合であって、 その[[文字符号化]]が [[UTF-8]] でない場合は、 [[IRI]] を[[文書]]中に [[UTF-8]] [[文字符号化]]で入れては'''なりません'''。 > Note: Some formats already accommodate IRIs, although they use different terminology. HTML 4.0 [HTML4] defines the conversion from IRIs to URIs as error-avoiding behavior. XML 1.0 [XML1], XLink [XLink], XML Schema [XMLSchema], and specifications based upon them allow IRIs. Also, it is expected that all relevant new W3C formats and protocols will be required to handle IRIs [CharMod]. 注意: 幾つかの書式は [[IRI]] を採用しています (違った用語を使っていることもありますが)。 [[HTML 4.0]] は誤り回復動作として [[IRI]] から [[URI]] への変換を定義しています。 [[XML 1.0]], [[XLink]], [[XML Schema]] やこれらを基にした仕様は [[IRI]] を認めています。また、 [[W3C]] のすべての関係する新しい書式やプロトコルは [[IRI]] を扱えることが要求されることが期待されます。 **6.4. Use of UTF-8 for Encoding Original Characters > This section discusses details and gives examples for point c) in section 1.2. To be able to use IRIs, the URI corresponding to the IRI in question has to encode original characters into octets by using UTF-8. This can be specified for all URIs of a URI scheme or can apply to individual URIs for schemes that do not specify how to encode original characters. It can apply to the whole URI, or only to some part. For background information on encoding characters into URIs, see also section 2.5 of [RFC3986]. この章は1.2節の c) についての詳細と例を示します。 [[IRI]] を使うことができるためには、ある [[IRI]] に対応する [[URI]] は元の[[文字]]を [[UTF-8]] を使って[[オクテット]]に[[符号化]]しなければなりません。 これはある [[URI scheme]] のすべての [[URI]] に対して規定することもできますし、 元の[[文字]]をどう[[符号化]]するか規定していない [[URI scheme]] の個々の [[URI]] に適用することもできます。 [[URI]] 全体に適用することもできますし、一部分のみに適用することもできます。 [[文字]]を [[URI]] に[[符号化]]する際の背景情報は [[RFC 3986]] の2.5節もご覧下さい。 > For new URI schemes, using UTF-8 is recommended in [RFC2718]. Examples where UTF-8 is already used are the URN syntax [RFC2141], IMAP URLs [RFC2192], and POP URLs [RFC2384]. On the other hand, because the HTTP URL scheme does not specify how to encode original characters, only some HTTP URLs can have corresponding but different IRIs. 新しい [[URI scheme]] では [[UTF-8]] を使うことが [[RFC 2718]] で推奨されています。例えば [[URN]] 構文や [[IMAP]] [[URL]] や [[POP]] [[URL]] で既に [[UTF-8]] が使われています。 一方で [[HTTP]] [[URL]] scheme は元の文字をどう符号化するか規定していませんから、 一部の [[HTTP]] [[URL]] だけしか対応する異なる [[IRI]] を持つことはできません。 > For example, for a document with a URI of "http://www.example.org/r%C3%A9sum%C3%A9.html", it is possible to construct a corresponding IRI (in XML notation, see, section 1.4): "http://www.example.org/résumé.html" ("é"; stands for the e-acute character, and "%C3%A9" is the UTF-8 encoded and percent-encoded representation of that character). On the other hand, for a document with a URI of "http://www.example.org/r%E9sum%E9.html", the percent-encoding octets cannot be converted to actual characters in an IRI, as the percent-encoding is not based on UTF-8. 例えば、 [[URI]] が [SAMP(URI)[http://www.example.org/r%C3%A9sum%C3%A9.html]] の[[文書]]で、対応する [[IRI]] を (1.4節の [[XML]] の記法で) [SAMP(URI)[http://www.example.org/r''é''sum''é''.html]] と構築することが可能です ([CODE(XML)[é]] は[[アキュート・アクセント]]付きラテン文字 e を表し、 [SAMP(URI)[%C3%A9]] はこの文字を [[UTF-8]] で[[符号化]]して[[百分率符号化]]した表現です)。しかし [[URI]] が [SAMP(URI)[http://www.example.org/r%E9sum%E9.html]] の[[文書]]では、 [[百分率符号化]]された[[オクテット]]が [[UTF-8]] に基づいていないので、これを [[IRI]] で実際の[[文字]]に変換することはできません。 > This means that for most URI schemes, there is no need to upgrade their scheme definition in order for them to work with IRIs. The main case where upgrading makes sense is when a scheme definition, or a particular component of a scheme, is strictly limited to the use of US-ASCII characters with no provision to include non-ASCII characters/octets via percent-encoding, or if a scheme definition currently uses highly scheme-specific provisions for the encoding of non-ASCII characters. An example of this is the mailto: scheme [RFC2368]. これはほとんどの [[URI scheme]] において [[IRI]] が機能するように scheme の定義を更新する必要がないことを意味しています。 Scheme の定義を更新することに意味がある場合というのは主として scheme の定義や scheme の特定の部品が厳密に [[US-ASCII]] [[文字]]に制限していて非 [[ASCII]] [[文字]]・[[オクテット]]を[[百分率符号化]]によって含めることができない場合や、 scheme の定義が現在 scheme 規定の方法で非 [[ASCII]] [[文字]]の[[符号化]]を定めている場合です。この例に [SAMP(URI)[[[mailto]]:]] scheme があります。 > This specification does not upgrade any scheme specifications in any way; this has to be done separately. Also, note that there is no such thing as an "IRI scheme"; all IRIs use URI schemes, and all URI schemes can be used with IRIs, even though in some cases only by using URIs directly as IRIs, without any conversion. この仕様はどの scheme 仕様をも更新しません。更新は別途行われなければなりません。 また、[Q[IRI scheme]] のようなものがないことにも注意して下さい。 すべての [[IRI]] は [[URI scheme]] を使い、すべての [[URI scheme]] は [[IRI]] で使うことができます。場合によっては [[URI]] を無変換で [[IRI]] として使うしか方法がないこともありますが。 > URI schemes can impose restrictions on the syntax of scheme-specific URIs; i.e., URIs that are admissible under the generic URI syntax [RFC3986] may not be admissible due to narrower syntactic constraints imposed by a URI scheme specification. URI scheme definitions cannot broaden the syntactic restrictions of the generic URI syntax; otherwise, it would be possible to generate URIs that satisfied the scheme-specific syntactic constraints without satisfying the syntactic constraints of the generic URI syntax. However, additional syntactic constraints imposed by URI scheme specifications are applicable to IRI, as the corresponding URI resulting from the mapping defined in section 3.1 MUST be a valid URI under the syntactic restrictions of generic URI syntax and any narrower restrictions imposed by the corresponding URI scheme specification. [[URI scheme]] はその scheme の [[URI]] の構文に制限を課すことができます。 つまり一般 [[URI]] 構文では認められる [[URI]] が特定の [[URI scheme]] 仕様によって課される狭められた構文的制約の下では認められないかもしれません。 [[URI scheme]] の定義は一般 [[URI]] 構文の構文的制限を緩めることはできません。 そうでなければ [[URI scheme]] 規定の構文的制約は満足するのに一般 [[URI]] 構文の構文的制約を満足しない [[URI]] が生成できてしまいます。 しかし、 [[URI scheme]] の仕様で課される追加の構文的制約は [[IRI]] にも適用され、3.1節で定義した写像の結果の対応する [[URI]] は一般 [[URI]] 構文の構文的制限及び対応する [[URI scheme]] の仕様で課された制限の下で妥当な [[URI]] でなければ'''なりません'''。 > The requirement for the use of UTF-8 applies to all parts of a URI (with the potential exception of the ireg-name part; see section 3.1). However, it is possible that the capability of IRIs to represent a wide range of characters directly is used just in some parts of the IRI (or IRI reference). The other parts of the IRI may only contain US-ASCII characters, or they may not be based on UTF-8. They may be based on another character encoding, or they may directly encode raw binary data (see also [RFC2397]). [[UTF-8]] を使うという要件は [[URI]] のすべての部分に適用されます (ただし [CODE(ABNF)[[[ireg-name]]]] 部は例外となり得ます)。 しかし、広範囲の文字を直接表現できる [[IRI]] の能力を使うのは [[IRI]] (や [[IRI参照]]) の一部分のみとすることも可能です。 [[IRI]] のほかの部分は [[US-ASCII]] [[文字]]だけを含むのでも構いませんし、 [[UTF-8]] に基づかなくても構いません。他の[[文字符号化]]に基づいていても構いませんし、 生のバイナリ・データを直接符号化しても構いません。 > For example, it is possible to have a URI reference of "http://www.example.org/r%E9sum%E9.xml#r%C3%A9sum%C3%A9", where the document name is encoded in iso-8859-1 based on server settings, but where the fragment identifier is encoded in UTF-8 according to [XPointer]. The IRI corresponding to the above URI would be (in XML notation) "http://www.example.org/r%E9sum%E9.xml#résumé";. 例えば、 [SAMP(URI)[http://www.example.org/r%E9sum%E9.xml#r%C3%A9sum%C3%A9]] のように[[文書]]の名前は[[鯖]]の設定に基づき [CODE(charset)[[[iso-8859-1]]]] で[[符号化]]し、[[素片識別子]]は [[XPointer]] に従い [[UTF-8]] で[[符号化]]した [[URI参照]]もあり得ます。この [[URI]] に対応する [[IRI]] は ([[XML]] の記法で) [SAMP(URI)[http://www.example.org/r%E9sum%E9.xml#r''é''sum''é'']] となります。 > Similar considerations apply to query parts. The functionality of IRIs (namely, to be able to include non-ASCII characters) can only be used if the query part is encoded in UTF-8. 同様のことが[[照会]]部にも言えます。 [[IRI]] の機能 (すなわち非 [[ASCII]] [[文字]]を含められること) は[[照会]]部が [[UTF-8]] で[[符号化]]されている時のみ使えます。 **6.5. Relative IRI References > Processing of relative IRI references against a base is handled straightforwardly; the algorithms of [RFC3986] can be applied directly, treating the characters additionally allowed in IRI references in the same way that unreserved characters are in URI references. [[基底]]に対する[[相対IRI参照]]の処理はそのまま行います。 [[RFC 3986]] の算法で [[IRI参照]]が認めている追加の[[文字]]を [[URI参照]]の[[非予約]]な[[文字]]と同じように扱うことで直接適用できます。 * メモ