Skip to content

Main content

Digital Edition Anchor Fragment

Percent-encode a supplied edition anchor of complete Unicode scalar values as a URL fragment without resolving a document or normalizing its identifier.

Loading tool…

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

  1. Enter anchorId. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
anchorIdNonempty 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 fieldInterpretationReturned shape
fragmentFragmentRequired. Text; maximum UTF-16 length 8192.
json
{
  "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

  1. Calculation and input contract: digital-humanities/digital-edition-anchor-fragment — tool.io

  2. ECMAScript: encodeURIComponent — Ecma International

Similar or alternative tools