question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

equal char in query value is not encoded

See original GitHub issue

I have a usecase which requires me to pass a query-string-like string as a query value.

import { withQuery } from 'ufo'

const url = withQuery('https://example.com', { p: 'k1=v1&k2=v2' })

const url2 = new URL('https://example.com')
url2.searchParams.set('p', 'k1=v1&k2=v2')

console.log('withQuery', url)
console.log('URL', url2.href)

The above sample prints the following results.

withQuery https://example.com?p=k1=v1%26k2=v2
URL https://example.com/?p=k1%3Dv1%26k2%3Dv2

As you can see, ufo does not encode = char while URL does.

Is there any reason to not escape equal char in a query value? Would be great if ufo can encode equal char as well.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yshrsmzcommented, May 11, 2021

Sorry, I mean “customer” by “client”.

I need to create a URL for my partner company’s web service(e.g. https://example.com/login?callbackState=k1=v1%26k2=v2)

0reactions
pi0commented, May 11, 2021

Can you possibly please ask him/her about what library/software is used and broken? That would help a lot deciding about this. In the meantime i will double check whatwg parser. Worst case we can add a flag for this 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do some query strings work even if parameters are not ...
The url parameter, http://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_sample_main_body.pdf , is not encoded. It contains ...
Read more >
Encoding issue for query parameter #1133 - OpenFeign/feign
It seems that in some cases, the query parameters are not encoded correctly. Some special characters like, e.g. equal sign (=) or quotes...
Read more >
Manage Unicode Characters in Data Using T-SQL - SQLShack
In this article, we'll give some valuable information on how to use Unicode in SQL Server and various problems that arise from the...
Read more >
12.8 String Functions and Operators - MySQL :: Developer Zone
CHAR () interprets each argument N as an integer and returns a string consisting of the characters given by the code values of...
Read more >
Guide to Java URL Encoding/Decoding - Baeldung
Simply put, URL encoding translates special characters from the URL to a representation that adheres to the spec and can be correctly ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found