[14] [DFN[ISO 3166]] は、[[国]]や[[地域]]に[[英数字]]の[[符号]]を割り当てた[[国際規格]]です。

* 種別

[15] 
[FIG(short list)[
- [[国符号][国名符号]]
-- [[2文字英字][地域部分タグ]]
-- 3文字[[英字]]
-- 3桁[[数字]]
]FIG]

** 特殊な符号

[20] 
予約や[[私用]]の[[符号]]の扱いについては、 [[地域部分タグ]]も参照。

[33] [[ccTLD]] はほぼ [[ISO 3166]] ですが、一部例外があります。

[34] 正式な [[ccTLD]] 以外に独自の[[符号]]を勝手に割り当てて私的に使っていることがあります。
[SEE[ [[TLD]] ]]

[289] [CITE@en-us[UTS #35: Unicode Locale Data Markup Language]] ([TIME[2011-07-19 03:14:51 +09:00]] 版) <http://unicode.org/reports/tr35/#Numeric_Codes>
では[[私用]]の2文字[[国符号]]、3文字[[国符号]]、3文字数値符号の対応関係が規定されています。


[26] [[BR]] に従う[[証明書]]では、[[国]]の指定として適切な[[国]]符号が割り当てられていない時
[CODE[[[XX]]]] を使います [SRC[>>28]]。

[REFS[
- [28] [CITE[[[BR]]]] ([TIME[2014-11-01 05:54:38 +09:00]] 版) <https://cabforum.org/wp-content/uploads/BRv1.2.3.pdf#page=19>
]REFS]



[17] [[LDML]], [[CLDR]], [[Android]] は [CODE[XA]], [CODE[XB]]
を[[擬似言語]]に割り当てています。


[39] 
[CITE@ja-JP[[[綜語]] / 宇田川浩行 / デライト]], [[希哲社]], [TIME[2023-11-25T13:29:43.000Z]] <https://dlt.kitetu.com/?fg=KNo.F85E/45E0>

>情報処理では ISO の言語コード・国名コードを独自に拡張し「[B[syn_KTK]]」[WEAK[(三文字)]],「[B[sy_KT]]」[WEAK[(二文字)]]を用いる。これにより,同じ情報を一般的な日本語(ja_JP)と,実験的な綜語で訳し分ける事などが可能になる。 


* 文脈

[FIG(short list)[ [19] [[ISO]] [[国符号]]の利用される場面
- [[IETF言語タグ]]の[[地域部分タグ]] (2文字[[英字]])
- [[ccTLD]]
- [CODE[$place]]
- [[Android]] [[設定修飾子]]
- [[CEA-2014-B]]
- [[ISO 4217]]
- [[UN/LOCODE]]
]FIG]




[[ISO 3166-1]] alpha-2
[[case-insensitive]]


[38] [CITE[DSSSL]], [TIME[2001-08-19T05:28:49.000Z]], [TIME[2023-11-23T08:14:19.063Z]] <http://www.y-adagio.com/public/standards/jis_dsssl/cls12.txt>

>
(46) 特質country:は,#f又はISO 3166で定義する国コードを大文字で指定する。これは,行の組立てに処理系固有の方法で影響する。初期値は#fとする。


[295] [CITE@en[RFC 5854 - The Metalink Download Description Format]]
( ([TIME[2014-09-14 16:54:14 +09:00]] 版))
<http://tools.ietf.org/html/rfc5854#section-4.2.16.2>

[22] [CITE[OASIS Open Document Format for Office Applications (OpenDocument) Version 1.2 - Part 1: OpenDocument Schema]]
([TIME[2011-09-29 13:00:00 +09:00]] 版)
<http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#a18_3_11countryCode>

[23] >>22 [[ISO 3166]] を参照しつつ、なぜか[[地域部分タグ]]も参照されています。


[FIG(quote)[
[FIGCAPTION[
[21] [CITE@EN[XPath and XQuery Functions and Operators 3.1]]
([TIME[2017-03-21 16:02:06 +09:00]])
<https://www.w3.org/TR/2017/REC-xpath-functions-31-20170321/#lang-cal-place>
]FIGCAPTION]

> The geographical area identified by a country code is defined by the boundaries as they existed at the time of the date to be formatted, or the present-day boundaries for dates in the future.

]FIG]


[FIG(quote)[
[FIGCAPTION[
[24] [CITE[Top-level Element: <originInfo> (MODS Ver. 3 User Guidelines: Metadata Object Description Schema, Library of Congress)]]
([TIME[2013-08-15 04:37:12 +09:00]])
<https://www.loc.gov/standards/mods/userguide/origininfo.html>
]FIGCAPTION]

> iso3166 – This source code is used with country codes from ISO 3166. See the ISO 3166 Code Lists  for a listing of the codes.

]FIG]


[FIG(quote)[
[FIGCAPTION[
[3] [CITE@en[RFC 7483 - JSON Responses for the Registration Data Access Protocol (RDAP)]]
([TIME[2017-05-07 17:28:01 +09:00]])
<https://tools.ietf.org/html/rfc7483#section-3>
]FIGCAPTION]

> 
>    country codes:    Where the identity of a geopolitical nation or
>                      country is needed, these identities are represented
>                      with the alpha-2 or two-character country code
>                      designation as defined in '''['''ISO.3166.1988''']'''.  The
>                      alpha-2 representation is used because it is freely
>                      available, whereas the alpha-3 and numeric-3
>                      standards are not.

]FIG]


[FIG(quote)[
[FIGCAPTION[
[9] [CITE[JSON API Reference | Worldpay Developer]]
([TIME[2017-02-14 01:34:22 +09:00]])
<https://developer.worldpay.com/jsonapi/api#orders>
]FIGCAPTION]

> countryCode:	String
> The ISO 3166 alpha-2 2-letter country code. ISO country codes are defined here. 

]FIG]


[FIG(quote)[
[FIGCAPTION[
[25] ([TIME[2004-09-21 00:09:43 +09:00]])
<https://www.cs.auckland.ac.nz/~pgut001/pubs/x509guide.txt>
]FIGCAPTION]

> Country codes in DNs created by MS software can contain values other than
>   the allowed two-character ISO code (for example three-character country name
>   abbreviations).

]FIG]


[FIG(quote)[
[FIGCAPTION[
[29] [CITE@en[RFC 5139 - Revised Civic Location Format for Presence Information Data Format Location Object (PIDF-LO)]]
([TIME[2018-02-11 18:30:45 +09:00]])
<https://tools.ietf.org/html/rfc5139#section-3.3>
]FIGCAPTION]

> The "country" element differs from that defined in '''['''RFC4119''']''' in that
>    it now restricts the value space of the element to two uppercase
>    characters, which correspond to the alpha-2 codes in '''['''ISO.3166-1''']'''.

]FIG]


[FIG(quote)[
[FIGCAPTION[
[30]  [CITE@en[RFC 4119 - A Presence-based GEOPRIV Location Object Format]]
([TIME[2018-02-11 21:10:31 +09:00]])
<https://tools.ietf.org/html/rfc4119>
]FIGCAPTION]

>    | country              | The country is       | US                  |
>    |                      | identified by the    |                     |
>    |                      | two-letter ISO 3166  |                     |
>    |                      | code.                |                     |

]FIG]


[31] [CITE@en[RFC 5774 - Considerations for Civic Addresses in PIDF-LO]]
([TIME[2018-02-11 19:30:46 +09:00]])
<https://tools.ietf.org/html/rfc5774#section-4.2.1>

[37] 
[CITE@en-US[Country, region, and language codes - Microsoft Support]], [TIME[2022-12-21T08:10:04.000Z]] <https://support.microsoft.com/en-us/topic/country-region-and-language-codes-add36afe-804a-44f1-ae68-cfb9c9b72f8b>

[[ISO 3166]] 2文字符号に似ているが、そうとは書かれていない謎体系。

[40] 
[[LeXML]] は地域を記述する符号体系として [CODE[ISO3166]] と [CODE[ccTLD]]
などを挙げています。 [[ccTLD]] を地域記述に用いるものとし、なぜか [[ISO 3166]]
とは別の選択肢で用意しています。


* 国内規格

[18] 
[DFN[KS X 1510-1:2008]],
[DFN[KS X 1510-2:2008]],
[DFN[KS X 1510-3:2008]]



- [35] [CITE@en[Recommendation 3]], [TIME[2013-11-07T16:50:06.000Z]], [TIME[2022-12-13T13:13:25.957Z]] <https://tfig.unece.org/contents/recommendation-3.htm>
-- [36] [CITE[Untitled-4 - rec03_ecetrd201.pdf]], [TIME[2021-12-08T12:10:17.000Z]], [TIME[2022-12-13T13:13:39.350Z]] <https://unece.org/fileadmin/DAM/cefact/recommendations/rec03/rec03_ecetrd201.pdf>


* メモ

- [1] ''ISO 3166 Maintenance agency (ISO 3166/MA)'' <http://www.iso.org/iso/en/prods-services/iso3166ma/index.html>
- [2] ''About ISO 3166 Country Codes - National Information Standards Organization (NISO)'' <http://www.niso.org/standards/resources/3166.html>
- [27] ''ISO 3166 Maintenance Agency (ISO 3166/MA)'' <http://www.din.de/gremien/nas/nabd/iso3166ma/> 2001年12月より前の ISO 3166/MA
- [4] ISO 3166-1 の2文字[[国名符号]]ならそこらじゅうに転がってますが、 -2 の地域名符号はないですね。 ISO 3166/MA も -1 は見れるようにしてるけど -2 は売ってる。
- [5] -2 の実体は各地域の地域名符号規格の寄せ集めらしい。例えば[[日本国]]の場合は JIS の[[都道府県名符号]] (数値) で [CODE[JP-01]] とか。
- [6] >>4-5 完全なのじゃなくてそういう部分的なのでよければ、検索すれば幾つか出てきますな。

[7] ISO 3166-1 の国名符号の商用利用は [[ANSI]]
に課金されるという話があって、
Unicode list で2003年3月に問題になっていました。
[[MichaelEverson]] が MA に問合せたところ、国名符号を使う規格なら実装しても問題なし、いけないのは国名リストを味付けした程度で販売することらしい、という感じですが、まだ確認を続ける、という段階のようなので、商用利用する時は気をつけたほうがいいでしょう。

[8] [CITE[lukes/ISO-3166-Countries-with-Regional-Codes]]
( ([TIME[2014-07-26 01:56:03 +09:00]] 版))
<https://github.com/lukes/ISO-3166-Countries-with-Regional-Codes>


[32] [CITE[hexorx/countries]]
( ([TIME[2014-07-26 01:59:53 +09:00]] 版))
<https://github.com/hexorx/countries>

[10] [CITE[datasets/country-codes]]
( ([TIME[2014-07-26 02:18:39 +09:00]] 版))
<https://github.com/datasets/country-codes>

[11] [CITE@en[ISO 3166 - Country codes - ISO]]
( ([[]] 著, [TIME[2014-07-24 14:23:47 +09:00]] 版))
<http://www.iso.org/iso/country_codes.htm>

[12] [CITE@en[ISO 3166-1 - Wikipedia, the free encyclopedia]]
( ([TIME[2014-07-22 05:08:26 +09:00]] 版))
<http://en.wikipedia.org/wiki/ISO_3166-1>

[13] [CITE[umpirsky/country-list]]
( ([TIME[2014-07-27 08:31:10 +09:00]] 版))
<https://github.com/umpirsky/country-list/>

[FIG(quote)[
[FIGCAPTION[
[16] [CITE@EN-US[Akoma Ntoso Naming Convention Version 1.0]]
([TIME[2019-02-22 02:00:00 +09:00]])
<https://docs.oasis-open.org/legaldocml/akn-nc/v1.0/os/akn-nc-v1.0-os.html#_Toc409028142>
]FIGCAPTION]

>  Country or subdivision (a two-letter or code according to ISO 3166-1 '''['''ISO3166''']''' or a short and unique alphanumeric codes according to ISO 3166-2 '''['''ISO3166-2''']'''). For an Akoma Ntoso XML representation, this value MUST correspond to the content of the element <FRBRcountry> in the metadata. (required)

]FIG]

[294] [CITE@en[ISO 3166-1 alpha-2 - Wikipedia, the free encyclopedia]]
( ([TIME[2014-07-22 05:08:26 +09:00]] 版))
<http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2>
