Estimate the RFC 3986 encoded length of a URL containing CJK, spaces or symbols (only alphanumerics and -_.~ are safe).
仅字母、数字及 -_.~ 为安全字符;其余均需编码。
| Item | Formula / Rule | Source / Standard |
|---|---|---|
| Unreserved characters | A–Z, a–z, 0–9, "-", ".", "_", "~" stay literal and keep their length | RFC 3986 §2.3 Unreserved Characters |
| Percent-encoding | Each byte needing escape expands to "%" plus two hex digits, tripling its length | RFC 3986 §2.1 Percent-Encoding |
| Space handling | Form encoding writes a space as "+" while path encoding uses "%20" | WHATWG URL Standard, application/x-www-form-urlencoded |