Description
Bug Report: Malformed UTF-8 Characters in Query Parameters in v3.5.6
Description
After v3.5.6, UTF-8 characters (e.g., Nordic characters like äöå
) in query parameters are being malformed into � in deployed environments. This issue only occurs when navigating within the application to a cached page with UTF-8 encoded query parameters. Reverting to v3.5.5 resolves the issue.
The issue is specific to deployed environments and is not reproducible locally, making debugging and reproduction more challenging.
Expected Behavior
When navigating to a page with UTF-8 encoded URL parameters, the request should return:
- HTTP 304: "Not Modified" with the query parameter
q=äää
.
Example:
GET /search?q=äää
Response: 304 Not Modified
Query: q=äää
Actual Behavior
Instead of returning the cached page, navigating to a cached page results in a redirect along with malformed query parameters:
- HTTP 308: Permanent redirect with query parameters encoded incorrectly.
Malformed Example:
GET /search?q=äää
Response: 308 Permanent Redirect
To: /_next/data/[hash]/search.json?q=%C3%A4%C3%A4%C3%A4
Actual Query: q=��� (Malformed)
Steps to Reproduce
- Deploy the reproduction example linked below.
- Navigate to
/search?q=äöå€
using the bottom button (direct navigation from URL works) - Observe the malformed query parameters after a redirect.
Minimal Reproduction
- Code: https://github.com/lamminsalo/Opennext-Query-Parameter-Minimal-Reproduction
- Live Environment: https://d16ppgwd8iy16k.cloudfront.net/
Discord Discussion
For additional context, see the ongoing thread on Discord:
https://discord.com/channels/1283128968140161065/1286094576788177059/1367919144694972569
Reproduction Environment
- Version: opennext v3.6.0
Manually tested that v3.5.6 is the breaking update.
EDIT: Added a more minimal reproduction repo and deployed it. Links and steps updated.