Glue a villager’s text into a URL, send it to the gudang, and see what becomes of the &, # and / inside it, and of a mismatched decode. An interactive…
A classic bug: & or = in user input leaks into a fake parameter, # cuts the URL, / shifts the path. Remember one rule: for one value (a query value, a path segment), encodeURIComponent, or let URLSearchParams encode it.
encodeURIComponent for a value, encodeURI for a whole URL
encodeURI for a param value & = ? # are left as they are, then leak into a fake param or cut the URL. For a VALUE always encodeURIComponent.& and # in user input still break the URL. Encode each value, or use URLSearchParams.decodeURI does not open %26, %2F, %3D. The pair of encodeURIComponent is decodeURIComponent; a + from URLSearchParams only becomes a space through URLSearchParams again.& leak into a fake param Situation 1: encodeURI on one value.# cut the address Situation 2: the rest of the text stays behind as the hash, never sent./ shift the path Situation 3: one shelf name becomes two segments.decodeURIComponent(encodeURIComponent(text)) comes back whole.