Skip to content

Fix #2672: Use Uri.encode instead of URLEncoder for custom search queries - #2675

Open
jahnaviNallavalli wants to merge 1 commit into
Neamar:masterfrom
jahnaviNallavalli:fix-search-provider-encoding
Open

jahnaviNallavalli wants to merge 1 commit into
Neamar:masterfrom
jahnaviNallavalli:fix-search-provider-encoding

Conversation

@jahnaviNallavalli

Copy link
Copy Markdown

Fixes #2672

Description

Replaces URLEncoder.encode() with Uri.encode() when interpolating query parameters into custom search provider URLs.

Using URLEncoder turns spaces into +, causing downstream intent handlers and browsers (such as Chromium/Vanadium) to re-encode the + into %2B, resulting in literal plus signs in search inputs. Uri.encode() applies standard percent-encoding (%20), ensuring correct whitespace parsing.

@marunjar

Copy link
Copy Markdown
Collaborator

@jahnaviNallavalli How was this tested and verified? Wich OS and browser?

@jahnaviNallavalli

Copy link
Copy Markdown
Author

Hi @marunjar,

To be transparent, I haven't run this on a physical device or emulator yet. The fix was prepared via code inspection based on issue #2672:

URLEncoder.encode() is meant for HTML form data (application/x-www-form-urlencoded), converting spaces to +. When parsed via Uri.parse() and launched via Intent, certain browsers (like Chromium/Vanadium mentioned in the issue) escape that + into %2B, causing the search field to display literal plus signs. Replacing it with Android's Uri.encode() encodes spaces to %20 directly.

I can set up a local build to test on a device/emulator if required, or if you already have the test environment running, I'd appreciate your feedback on the behavior!

@marunjar

Copy link
Copy Markdown
Collaborator

Thanks, but not needed anymore.
Everything is working (again), see #2672

This branch has not been deployed

No deployments
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.

Plus signs in custom web search provider incorrectly converted

2 participants