Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output in browser presented in quotes #8

Open
Davix-Pixie opened this issue Nov 14, 2020 · 2 comments
Open

Output in browser presented in quotes #8

Davix-Pixie opened this issue Nov 14, 2020 · 2 comments

Comments

@Davix-Pixie
Copy link

Issue: When searching for more than one word with space between, easysearch/ Keypirinha outputs incorrect url which leads to

Examples:
Definition:
[engines]
g = Google https://www.google.com/search?q={q}

Input 1: Keypirihna: g this is an example
Output 1: msedge: ULR: http://%22https//www.google.com/search?q=this%20is%20an%20example%22

Input 2: Keypirihna: g example
Output 2- OK: https://www.google.com/search?q=example

Microsoft Edge Version: 86.0.622.69 (Official build) (64-bit)

(#. Note:

  1. this issue was reported to be disappeared by another user in keypirinha 2.26 but it seems to persist even now

  2. at first multi word search used to work like a charm.. but now I think due to some changes in the settings of either the browser, or easysearch this no longer works as intended.

  3. either way the google searches use "+"
    Therefore, an option to how to handle spaces in argument to be included is a must)

(#. not a developer or used to github, pardon for any unfamiliarity in communication)

@phu54321
Copy link

phu54321 commented Dec 25, 2020

This seems to be edge-specific issue. Edge doesn't like spaces in URL.

You can fix this by changing

target = target.strip().format(q = term.strip())
to line below

                    target = target.strip().format(q = term.strip().replace(' ', '%20'))

To fix this yourself,

  1. Rename EasySearch.keypirinha-package to EasySearch.zip
  2. Open that with your favorite zip viewer
  3. Patch easysearch.py
  4. Undo rename at (1).

@groenmj
Copy link

groenmj commented May 23, 2021

This seems to be edge-specific issue. Edge doesn't like spaces in URL.

Maybe the issue does not show with other browsers, but according to RFC 1738 spaces or "unsafe" characters and must be encoded.

You can fix this by changing

target = target.strip().format(q = term.strip())

to line below

                    target = target.strip().format(q = term.strip().replace(' ', '%20'))

This properly encodes spaces, but there are many more "unsafe" characters.

@TakahiroSato provided a better solution relying on urllib.parse.quote. See his PR #5 . You can download the fixed package from the dev-branch in his fork.

--Mark

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

No branches or pull requests

3 participants