Read a language range
01A language tag labels content. A language range expresses which labels a user wants. Smaller pieces called subtags are separated by hyphens. Here, de-CH labels German used in Switzerland.
de-* needs extended-range handling; de_CH fails both range grammars. An invalid range must not silently become a different preference.
Key idea: Matching MUST ignore case; a language label is not a translation or proof of comprehension.
Terms
- Language tag
- A label attached to content, such as de-CH.
- Subtag
- One hyphen-separated piece of a tag or range.
- Language range
- A requested label or pattern used for comparison.
Rules & examples
Matching MUST ignore case; a language label is not a translation or proof of comprehension.
- de-CH is a content label; de is a requested range. DE-ch and de-CH compare alike: capitalization conventions MUST NOT change matching.
- A basic range is * alone, or 1–8 ASCII letters followed by hyphen-separated pieces of 1–8 ASCII letters or digits. Extended ranges may use * in individual subtag positions.
- de-* is an extended range, not a basic range. de_CH fails both grammars because underscore is not a hyphen. Range syntax is not IANA registry validation.
- If an application canonicalizes ranges, it MUST also canonicalize compared tags or match both original and canonical ranges (§3.2). This example only compares ASCII case.
- Unusual preferences can help a receiver infer or track information about a user (§5). A matching label does not guarantee mutual comprehension.
RFC4647 is the matching part of BCP47. RFC5646 is the current tag-syntax companion. Verified editorial erratum8838 corrects the §2.2 pointer to §3.3.2; no algorithm change.
Sources
New to this? Start hereA quick picture + helpful background
Requested languages and available labels
Imagine a catalog of labeled documents. A filter keeps all labels that fit a pattern; a lookup tries preferences and returns one exact label or a defined default. Neither operation translates the document or guarantees understanding.
Helpful first, if these ideas are unfamiliar
These pictures are analogies to help you learn. The linked RFC explains the actual rules.
Related RFCs and changes
“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.