Malformed Percent Encoding in Query String – Why URLSearchParams Still Parses

Local only

Show how malformed percent-encoded UTF-8 can parse with replacement characters rather than raising an exception.

15 chars · 1 line

20 chars · 3 lines

1 parameter1 unique keys

Malformed query encoding

Why malformed percent encoding may not throw a query parse error

URLSearchParams is forgiving. An incomplete UTF-8 sequence can be decoded with the Unicode replacement character while an incomplete percent escape remains literal text. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • Browser-native URLSearchParams behavior
  • Full URL and raw query parsing
  • Repeated parameter preservation
  • JSON object to query construction
  • Browser-local processing

Steps

  1. Paste the malformed query into Parse to JSON.
  2. Look for the replacement character � or leftover percent text.
  3. Correct the original UTF-8 percent sequence rather than relying on forgiving decoding.

Forgiving parsing does not mean the source encoding is correct

The browser URLSearchParams implementation does not necessarily reject malformed percent-encoded UTF-8 as a syntax error.

A replacement character in the decoded result is a signal to inspect the original bytes or upstream URL construction.

Incomplete UTF-8 percent sequence

The parser returns a replacement character and leftover %A text.

Query string

?value=%E0%A4%A

Parsed JSON

{
  "value": "�%A"
}

Common questions

Frequently asked questions

Why is there no parser error?

URLSearchParams uses forgiving form-url-encoded decoding rather than strict UTF-8 validation.

What does � mean?

It is the Unicode replacement character, commonly used when bytes cannot be decoded as valid text.

Should I accept this value as valid?

Usually not without understanding the upstream encoding. The page describes parser behavior, not application-level validity.

Debugging a specific Query String issue? Browse Query String troubleshooting.