跳到主要内容
uencoder

URL Syntax RFC 3986

URI generic syntax components, delimiters, 和 parsing rules per RFC 3986.

URI Components

A URI is composed of up to five components separated by specific delimiters: scheme, authority, path, query, and fragment. The authority itself contains an optional userinfo, host, and port. The scheme is case-insensitive, while the host and scheme are normalized to lowercase in practice. Each component has its own set of allowed characters and percent-encoding rules.

scheme
Protocol identifier before the colon
https:
authority
userinfo@host:port between double slashes
//user@host:8080
path
Slash-separated segments after authority
/a/b/c
query
Question-mark-prefixed key-value pairs
?q=1&r=2
fragment
Hash-prefixed client-side identifier
#section

Normalization

URI normalization produces a canonical form for comparison. Case normalization lowercases the scheme and host. Percent-encoding normalization uppercases hex digits and decodes unreserved characters. Path normalization removes dot-segments like . and .. The WHATWG URL Standard defines a stricter parsing algorithm than RFC 3986 that browsers follow, resolving some ambiguities in the RFC.

Internationalized URIs

RFC 3986 requires ASCII, so internationalized characters in the host are encoded as Punycode and other components are percent-encoded UTF-8. The IRI (Internationalized Resource Identifier) standard allows non-ASCII directly in the source form, which is converted to URI form for transmission. Browsers display the IRI form to users while resolving the ASCII URI. This dual representation requires care when comparing URIs from different sources.

相关工具

参考链接