Visual RFC.
ALL RFCs / RFC 4647
Read the RFC ↗
RFC 4647 / LANGUAGE MATCHING

Read a language range

01

A 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.

RFC 4647 · § 2EXAMPLE
4 / 4
04
Choose the range grammar

de-* needs extended-range handling; de_CH fails both range grammars. An invalid range must not silently become a different preference.

Read a language rangede-* needs extended-range handling; de_CH fails both range grammars. An invalid range must not silently become a different preference.Which range grammar?debasic and extendedde-*extended onlyde_CHneitherUnderscore is not a hyphenSyntax does not validate the registry entry

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.

Look up a term in the glossary ↗

Rules & examples
  • 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
Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
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.

All chapters in RFC 4647

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗