FIELD NOTES · ACCEPTANCE EXERCISES

Encode the Chinese path segment, not the whole URL

A copied Chinese slug can turn into a broken link when a supplier encodes the full URL as though it were one parameter. Agree which values are path segments and which are query values. Keep the URL structure intact and test characters that can otherwise act as separators.

Who should use this acceptance brief

Businesses commissioning multilingual resource URLs. Use this as a scoped website handover task. Where real system evidence is required, teaching examples are not a substitute.

Source-bound platform fact

encodeURIComponent encodes an individual URI component, including characters that can have separator meaning. It is not a function to apply blindly to a complete URL. MDN: encodeURIComponent · Checked 16 October 2026.

Filled teaching example

Synthetic example, not a client case. Finite inputs, expected decisions and counterexamples follow; no live integration is claimed.

On narrow screens, scroll to read the complete table.

Input / caseCheck basisExpected decision
segment=报价component encoding%E6%8A%A5%E4%BB%B7
segment=A/Bslash part of valueA%2FB
already encoded valuerisk double encodingagree input contract

Run the acceptance exercise

  1. Specify whether the application receives raw Unicode segments or an already-encoded path.
  2. Construct a test URL from an approved base and individually encoded values.
  3. Follow the actual new route and verify canonical, decoded identity and round-trip links.

Interpret the result and retain evidence

The fixture encodes only raw segments and returns their strings; it does not fetch a route or prove every server accepts an encoded slash. If a slash is not allowed in a business slug, reject it under that policy rather than assuming encoding makes it supported. Preserve the raw/encoded boundary in the handover.

Limits before implementation

No old slugs, canonicals or redirects are changed. Excludes arbitrary URL validation and server-specific routing support.

Replay the finite example

Save both files in one folder and run with Node22.13 or newer. The example sends no network requests and changes no account or site. Filled inputs and expected outputs · Inspectable functions

node decision-check.mjs bilingual-url-segment-encoding.json