Description
Locate percent signs that begin valid two-hex-digit URI octet escapes and invalid percent positions using UTF-16 offsets; does not decode or normalize a URI.
URI text contains components and percent-encoded octets. A percent sign plus two hex digits describes one octet, while UTF-8 decoding and component-specific validity are additional questions. Host and port notation also needs to distinguish an absent field from an explicitly empty one.
Locate percent signs that begin valid two-hex-digit URI octet escapes and invalid percent positions using UTF-16 offsets; does not decode or normalize a URI.
When to use this tool
Use Parsing: URI Percent Triplet Position when you need this local percent-encoding or host/port-notation check on supplied text.
How to use the tool and how it works
- Enter text. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read result. Expand result to inspect the returned fields.
Scan each percent sign at zero-based UTF-16 offsets. Classify it as valid when the next two characters are ASCII hex digits, skipping those two characters afterward; otherwise record an invalidPercentOffset. Return both offset lists inside result.1
Percent-encoding represents an octet with a percent sign and two hexadecimal digits. Character decoding and a component's allowed use of that octet need additional interpretation.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| text | Supplied text under the stated token or offset convention. | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Object containing the calculated result members described below. | Required. Object. |
| result.validTripletOffsets | Zero-based UTF-16 offsets of syntactically valid percent triplets. | Calculated result member: array. |
| result.invalidPercentOffsets | Invalid Percent Offsets | Calculated result member: array. |
{
"input": {
"text": "a%20%GG%"
},
"output": {
"result": {
"validTripletOffsets": [
1
],
"invalidPercentOffsets": [
4,
7
]
}
}
} Limitations and assumptions
- A syntactically valid percent triplet is not necessarily valid UTF-8 or an acceptable encoded character in a particular URI component. Nothing is decoded, normalized, or checked as a complete URL.
- Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
Alternative or Complementary methods
Use a URI parser and component-appropriate decoding when a full address is needed. Verify octet encoding, UTF-8 interpretation, component boundaries, and endpoint constraints separately.
References
-
Calculation and input contract: parse/uri-percent-triplet-position — tool.io
-
RFC 3986: Percent-Encoding — IETF / RFC Editor
Similar or alternative tools
- URI Authority Empty Port Marker
Return host, literal port or empty string, and explicitEmpty only when a colon was present with no digits.
- CSV Quoted Newline Byte Offset
For every LF code unit return the UTF-8 byte length of the prefix before it as newlineByteOffsets, measured from the start of the supplied field including its opening quote.