この話以前したかもしれない。
https://url.spec.whatwg.org/#fragment-percent-encode-set
The fragment percent-encode set is a percent-encode set consisting of the C0 control percent-encode set and U+0020 SPACE, U+0022 ("), U+003C (<), U+003E (>), and U+0060 (`).
つまりASCIIの印字可能文字で言うと"<>`の4字を除いた90字だとWHATWGで言われてる。勉強なった。
浅墓だった。読みたりなかった。
A valid URL string must be either a relative-URL-with-fragment string or an absolute-URL-with-fragment string.
An absolute-URL-with-fragment string must be an absolute-URL string, optionally followed by U+0023 (#) and a URL-fragment string.
A URL-fragment string must be zero or more URL units.
ここまで読んだ後に。
The URL units are URL code points and percent-encoded bytes.
そして本題に入るかと。
The URL code points are ASCII alphanumeric, U+0021 (!), U+0024 ($), U+0026 (&), U+0027 ('), U+0028 LEFT PARENTHESIS, U+0029 RIGHT PARENTHESIS, U+002A (*), U+002B (+), U+002C (,), U+002D (-), U+002E (.), U+002F (/), U+003A (:), U+003B (;), U+003D (=), U+003F (?), U+0040 (@), U+005F (_), U+007E (~), and code points in the range U+00A0 to U+10FFFD, inclusive, excluding surrogates and noncharacters.
つまりパーセントエンコーディング不要なASCIIの文字は全部で81文字であるという。
………などとして読んだが、どうやら「URLを解析する」場合において角括弧などの、URL code pointsでない文字(というかバイト?)はbasic URL parserの第9ステップ内「fragment state」にてvalidation errorはされるものの………
A validation error does not mean that the parser terminates.
とあることから、一応その後に「パーセントエンコーディングすべきバイトをパーセントエンコーディングする」というわけで。だからこそTIO.runでの反則技「フラグメント内にハッシュ」がうまくゆくのかと。