🛠

URLエンコード関連メモ

に公開
1

Discussion

kuboshokubosho

URLSearchParamsについてです。

RFC1738 では () をエンコードしないので RFC1738 ではない
じゃ何?

URLSearchParamsを使った場合 application/x-www-form-urlencoded 形式でパースされますが、どういった文字がパーセントエンコードの対象になるかは、URL Standardの「1.3. Percent-encoded bytes」で定義されています。

The application/x-www-form-urlencoded percent-encode set is the component percent-encode set and U+0021 (!), U+0027 (') to U+0029 RIGHT PARENTHESIS, inclusive, and U+007E (~).

U+0028 LEFT PARENTHESIS, U+0029 RIGHT PARENTHESISは application/x-www-form-urlencoded 形式のパース対象という認識です。