HTTP Accept-Language Parser
Parse RFC 4647 basic language ranges and HTTP quality weights while retaining header order.
Description
Accept-Language expresses preferred language ranges with optional weights.
When to use HTTP Accept-Language Parser
Use this tool to parse RFC 4647 basic language ranges and HTTP quality weights while retaining header order.
Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.
How to use HTTP Accept-Language Parser and understand its results
- Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.
- Enter header using the field table and calculation rules, then run the tool.
- Read languages. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| header | Accept-Language field value. | string; maximum length: 1000000 | Required |
Paste the field value. Split commas and skip empty groups; accept * or an alphabetic 1–8-character primary range with 1–8-character alphanumeric subtags. Allow only an optional q parameter, case-insensitively, from 0 to 1 with up to three decimal digits. Return ranges and weights in source order, including duplicates.
quality=explicit q or 1; output range=lowercase input range Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| languages | Language ranges and their quality weights. | list of object; minimum entries: 0; maximum entries: 100000 |
{
"input": {
"header": "en-US, de;q=0.8, *;q=0"
},
"output": {
"languages": [
{
"range": "en-us",
"quality": 1
},
{
"range": "de",
"quality": 0.8
},
{
"range": "*",
"quality": 0
}
]
}
} Limitations and assumptions
No language availability, registry membership, locale fallback or content negotiation is determined. Extended wildcard ranges and extra parameters are rejected.
Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.
Alternative or Complementary methods
Use HTTP Accept Parser: Parse media ranges, parameters, and q weights in Accept without collapsing order or choosing a representation. For a complementary task, use HTTP Content-Type Parser: Parse an HTTP media type and its parameters, preserving parameter values and rejecting duplicate names.
Further background: RFC 9110: Accept-Language.
References
-
HTTP Accept-Language Parser — tool.io
-
RFC 9110: Accept-Language — HTTP Working Group
Similar or alternative tools
- HTTP Accept Parser
Parse media ranges, parameters, and q weights in Accept without collapsing order or choosing a representation.
- HTTP Content-Type Parser
Parse an HTTP media type and its parameters, preserving parameter values and rejecting duplicate names.