Skip to content

Encode the whole query in browser searches - #351

Merged
ospfranco merged 1 commit into
ospfranco:mainfrom
bardrop-oss:fix-browser-search-encoding
Nov 24, 2026
Merged

ospfranco merged 1 commit into
ospfranco:mainfrom
bardrop-oss:fix-browser-search-encoding

Conversation

@bardrop

@bardrop bardrop commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Browser search drops part of the query when it has &, # or + in it:

Typed in Sol What gets searched
AT&T stock AT
C# vs F# C
c++ tutorial c tutorial

All engines use encodeURI(query), which leaves those characters as URL syntax. With a custom engine, a $& in the query also got replaced by %s, because it is a special pattern in String.replace.

I moved the URL building to lib/searchEngines.ts, so it is one encodeURIComponent for every engine instead of five copies, and it can be tested without React Native. Nothing else in the key handler changes.

bun test src/lib passes (63). With encodeURI put back, 20 of the new cases fail. I did not build the macOS app.

@ospfranco
ospfranco merged commit 28f5d13 into ospfranco:main Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants