Description
Percent-encode a supplied anchor identifier into a URL fragment.
Digital editions separate source readings, editorial uncertainty, witness locators, image requests, identifiers and rights statements. XML character/attribute rules differ from display labels, while URI fragments and TEI pointers need their target-document context. An identifier key or formatted token does not authenticate a witness, validate an edition or authorize reuse.
Percent-encode a supplied anchor identifier into a URL fragment.
When to use this tool
Use Digital Edition Anchor Fragment when you already have anchorId and need to percent-encode a supplied anchor identifier into a URL fragment.
How to use the tool and how it works
- Enter anchorId. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read fragment. Use the output convention below.
Require anchorId nonempty and no unpaired UTF-16 surrogate; return #+encodeURIComponent(anchorId).1
URI-component encoding converts reserved characters inside the anchor to percent-encoded sequences. It does not resolve the target or perform XML identifier or HTML document validation.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| anchorId | Nonempty text without unpaired UTF-16 surrogates; URI-component encoded after the leading #. | Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| fragment | Fragment | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"anchorId": "page 17"
},
"output": {
"fragment": "#page%2017"
}
} Limitations and assumptions
- No target URL or HTML/XML identifier is validated or resolved. URI-component encoding preserves some punctuation and is not a complete document-linking policy.
- 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
Validate the complete XML/TEI document or IIIF request when technical conformance matters, and inspect the original witness and rights record for editorial use. Preserve uncertain readings, source order and attribution rather than treating local tokens as verified scholarly interpretations.
References
-
Calculation and input contract: digital-humanities/digital-edition-anchor-fragment — tool.io
-
ECMAScript: encodeURIComponent — Ecma International
Similar or alternative tools
- TEI Rendition Pointer Token
Prefix a supplied rendition identifier with a fragment marker.
- TEI Hand Shift Reference
Build a hand-shift reference from a restricted ASCII identifier.