URL 解析与编码
把 URL 解析为协议、主机、路径和查询参数,或对文本进行百分号编码与解码。
完全在浏览器中运行 — 粘贴的内容不会被上传。
单个参数值用组件;转义整个地址又希望 / ? # & = 保持可读时用完整 URI。
https%3A%2F%2Fwww.ryuslog.com%2Fblog%3Fcategory%3DTypeScript%26tag%3Dtypes%2Bgenerics%26page%3D2%23results
- 协议
- https:
- 主机
- www.ryuslog.com
- 路径
- /blog
- 片段
- #results
| 键 | 原始值 | 解码值 |
|---|---|---|
| category | TypeScript | TypeScript |
| tag | types+generics | types generics |
| page | 2 | 2 |
URL 保留字符
快速参考- %20
- 空格的编码。在查询字符串中,多数表单解析器也把 + 读作空格。
- %2F %3F %23
- 斜杠、问号和井号的编码,这三个字符否则会改变 URL 结构。
- %26 %3D
- 与号和等号的编码,在参数值内部使用以避免查询被拆分。
- encodeURIComponent
- 转义单个参数值,连 / ? # & = 一起处理 — 查询值应选它。
- encodeURI
- 保留 URL 结构字符,因此用于整个 URL 而不是单个值。
- new URL(input)
- 内置解析器,可读取 protocol、host、pathname、searchParams 和 hash。
Next.js 相关语法指南
全部 Next.js 指南Next.js Server Actions: Swallowed Redirects and Body Limits
redirect() throws, so a try/catch swallows the navigation; the action body parser has a 1 MB limit; and useActionState cannot hold an Error. Fixes for all three.
Next.jsSupabase SSR on Next.js: Stale Sessions and Lock Timeouts
The session flips between signed-in and signed-out because the refreshed token is written to a cookie store that no longer exists. Adapter, proxy and lock fixes.
Next.jsNext.js Standalone in Docker: Missing CSS and sharp Module Errors
output standalone copies server.js only, so /_next/static and public are missing and every page renders unstyled. The image and copy fixes, plus the sharp native binding error.
Next.jsNext.js 16 Upgrade: Async Params, proxy.ts, and Turbopack Build Breaks
The codemod gets you most of the way; the rest is async request APIs, a webpack config Turbopack refuses, and a renamed middleware file that silently stops running.