[] Browser URL copy does not encode URI string

REPRODUCIBILITY: 100% (always)
HARDWARE: Sony Xperia 10 III - xqbt52 - xqbt52 - - aarch64
UI LANGUAGE: English (UK) (user: en_GB, os: en_GB.utf8)

DESCRIPTION: introduced the ability to copy URLs to clipboard quickly.
However the URL is copied literally, which causes problems when pasting, e.g. if the URI contains space characters.



  1. Browse to an URL with spaces (or other characters which break an URL)
  2. Long press location bar to copy to clipboard
  3. Paste clipboard somewhere
  4. Try to open the pasted link


Pasted URL should open


Link is likely to not work correctly, depending on whether the app receiving the URL sanitizes the link or not.


  • Patchmanager: yes
  • OpenRepos: yes
  • Chum: yes
  • Other: no:


Further discussion possibly at Encode URL string before copying to clipboard by nephros · Pull Request #1004 · sailfishos/sailfish-browser · GitHub

Device Owner User: nemo
Home Encryption: enabled

the initial version of this bug report was created using Bugger 0.9.8+git1

FWIW that is the same behaviour as copying the address the old way.
It would be very confusing if they behaved differently.

I’m not disagreeing with that it would be handy (at least sometimes), but is there precedent for that it should work that way?
Edit: my desktop browser seems to do it after all, so i guess it is convention.

1 Like

It’s not just convention, that is the actual URL. Browsers will ‘helpfully’ hide the ‘scary details’ from you when displaying a URL. But a URL (URI) can only use a limited set of characters directly, every character in the URL not in this ‘safe’ set has to be percent encoded. Spaces for example are not in the safe set, and therefore must be percent encoded.

So when you copy a URL and it is not percent encoded, what you have is no longer a URL.


Can you give an example that causes problems?

Easiest is probably a SFOS Backup location at a NextCloud account, where the url is:

https://nextcloud.example.com/Sailfish OS/Backups/

And you would expect that it is copied as



Yes, of course! A literal space is a terminator for URLs.

Yes because that is an actual URL. The other one is an url-like string ( or a (likely invalid)url plus another string).

And it’s easy to do, it just needs Clipboard.text = Qt.encodeURI(url).

Does someone know why firefox on desktop doesn’t do this? Is there a downside?

I would say its a feature request, not a bug.

1 Like

This is one solution and would have the same end result, but probably the wrong value is being used to start with. I.e. instead of requesting the ‘display form’ from the browser, the ‘url form’ should be requested directly so that the roundtrip URL → displayable text → URL is avoided.

I guess, but AFAIK WebView does not expose the ‘internal’ variant, (or it is implicitly decoded on url->string conversion), anyway this is the relevant bit in the QML, hence my suggestion to use the JS encodeURI function:

[EDIT:] Made a PR at Encode URL string before copying to clipboard by nephros · Pull Request #1004 · sailfishos/sailfish-browser · GitHub


Thanks for suggesting this @nephros, and then for fixing it! As your PR has been merged, I’ve tagged it as fixed, as in theory it should make it into the next major release. Great work!

1 Like