Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8435915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:03:03+00:00 2026-06-10T07:03:03+00:00

When I enter a URL into maps.google.com such as https://dl.dropbox.com/u/94943007/file.kml , it will encode

  • 0

When I enter a URL into maps.google.com such as https://dl.dropbox.com/u/94943007/file.kml , it will encode this URL into:

https:%2F%2Fdl.dropbox.com%2Fu%2F94943007%2Ffile.kml

I am wondering what is this encoding called and is there a way to encode a URL like this using python?

I tried this:

The process is called URL encoding:

>>> urllib.quote('https://dl.dropbox.com/u/94943007/file.kml', '')
'https%3A%2F%2Fdl.dropbox.com%2Fu%2F94943007%2Ffile.kml'

but did not get the expected results:

'https%3A//dl.dropbox.com/u/94943007/file.kml'

what i need is this:

https:%2F%2Fdl.dropbox.com%2Fu%2F94943007%2Ffile.kml

how do i encode this URL properly?

the documentation here:

https://developers.google.com/maps/documentation/webservices/

states:

All characters to be URL-encoded are encoded using a ‘%’ character and
a two-character hex value corresponding to their UTF-8 character. For
example, 上海+中國 in UTF-8 would be URL-encoded as
%E4%B8%8A%E6%B5%B7%2B%E4%B8%AD%E5%9C%8B. The string ? and the
Mysterians would be URL-encoded as %3F+and+the+Mysterians.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:03:05+00:00Added an answer on June 10, 2026 at 7:03 am

    Use

    urllib.quote_plus(url, safe=':')
    

    Since you don’t want the colon encoded you need to specify that when calling urllib.quote():

    >>> expected = 'https:%2F%2Fdl.dropbox.com%2Fu%2F94943007%2Ffile.kml'
    >>> url = 'https://dl.dropbox.com/u/94943007/file.kml'
    >>> urllib.quote(url, safe=':') == expected
    True
    

    urllib.quote() takes a keyword argument safe that defaults to / and indicates which characters are considered safe and therefore don’t need to be encoded. In your first example you used '' which resulted in the slashes being encoded. The unexpected output you pasted below where the slashes weren’t encoded probably was from a previous attempt where you didn’t set the keyword argument safe at all.

    Overriding the default of '/' and instead excluding the colon with ':' is what finally yields the desired result.

    Edit: Additionally, the API calls for spaces to be encoded as plus signs. Therefore urllib.quote_plus() should be used (whose keyword argument safe doesn’t default to '/').

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get an HttpRequest to post this URL https://www.iformbuilder.com/exzact/_emptyTable.php?PAGE_ID=1234&TABLE_NAME=table_name_here&USERNAME=yo@yo.com&PASSWORD=What!What ! I've tried
If i enter a url directly into the address bar of the browser, i
I have a textbox where user will enter the url of the image :
I have a page like this. User write an URL into a form and
I can paste javascript into the URL bar of Firefox or enter it in
I log into mysql like normal but whenever I enter a command such as
When I copy a domain name from Google Maps and then paste it into
I want to be able to enter a URL into a form, without clicking
require 'open-uri' print Enter a URL add = gets open(#{add}) do |f| j =
I need the user to enter a URL within my form. However, URL is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.