コンテンツへスキップ
uencoder

URL エンコード Reserved 文字

Percent-エンコード ルール 用 reserved URI 文字 defined によって RFC 3986.

Reserved Characters

RFC 3986 defines a set of reserved characters that have special meaning within a URI and must be percent-encoded when used as data. Encoding replaces the character with '%' followed by two uppercase hexadecimal digits of its ASCII value. The general delimiters separate URI components, while sub-delimiters separate parts within a component. A decoder must not unescape reserved characters prematurely, or the URI structure can be corrupted.

:
General delimiter, separates scheme/host/port
%3A
/
General delimiter, path separator
%2F
?
General delimiter, starts query string
%3F
#
General delimiter, starts fragment
%23
&
Sub-delimiter, separates query parameters
%26
=
Sub-delimiter, separates key and value
%3D

Unsafe Characters

Some characters are not strictly reserved but are unsafe because they can be misinterpreted or transformed by gateways. Spaces, angle brackets, curly braces, and the double quote fall into this category and should be encoded even when they appear to render correctly. The space character is commonly encoded as '%20', though form-urlencoded payloads use '+' instead. Encoding unsafe characters prevents loss of data through transcoding intermediaries.

Encoding Algorithm

The encoder iterates over each byte of the input and leaves unreserved characters untouched. Unreserved characters are alphanumerics and '-', '_', '.', and '~', which never need encoding. Every other byte is converted to its percent-encoded form using uppercase hex digits. Lowercase hex digits are accepted by decoders but the RFC recommends uppercase for consistency. Multi-byte UTF-8 sequences are encoded byte by byte, not as a single code point.

関連ツール

参考链接