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

  • Home
  • SEARCH
  • 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 7628189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:33:42+00:00 2026-05-31T05:33:42+00:00

I tried this: String query = http://maps.googleapis.com/maps/api/geocode/xml?address=+country+++province+++city+&sensor=false; try { query = URLEncoder.encode(query, UTF-8); }

  • 0

I tried this:

String query = "http://maps.googleapis.com/maps/api/geocode/xml?address="+country+"+"+province+"+"+city+"&sensor=false";

try {
    query = URLEncoder.encode(query, "UTF-8");
}
catch (Exception e) {
    println("getLatLonFromAdress URLEncoder error: "+e);
    return  new float[] { -1f, -1f };
} 

but it turns the url into:

http%3A%2F%2Fmaps.googleapis.com%2Fmaps%2Fapi%2Fgeocode%2Fxml%3Faddress%3DCanada%2BAlberta%2BGrande+Cache%26sensor%3Dfalse

So I only want to encode country, province and city. Is it bad to handle that in one try block? Like:

try {
    country = URLEncoder.encode(country, "UTF-8");
    province = URLEncoder.encode(province, "UTF-8");
    city = URLEncoder.encode(city, "UTF-8");
}
catch (Exception e) {…}
  • 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-05-31T05:33:43+00:00Added an answer on May 31, 2026 at 5:33 am

    The UnsupportedEncodingException will not be thrown if you are passing “UTF-8” as that will always be present. Therefor you can happily handle them all in 1 catch.

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

Sidebar

Related Questions

Tried this: $('.link').click(function(e) { $.getScript('http://www.google.com/uds/api?file=uds.js&amp;v=1.0', function() { $('body').append('<p>GOOGLE API (UDS) is loaded</p>'); }); return
I have a query string passed in through an HTTP request that has this
I've tried this: string newScript = textBox1.Text; HtmlElement head = browserCtrl.Document.GetElementsByTagName(head)[0]; HtmlElement scriptEl =
I tried decoding this base64 string so many times but every time i get
I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item(Post), \b\#\b) But it is
Have you ever tried this before? static void Main(string[] args) { int x =
I am attempting to compress a string via use of zlib (I've tried this
I want to convert a primitive to a string, and I tried: myInt.toString(); This
Due to factors outside my control, I need to handle urls like this: http://www.bob.com/dosomething.asp?val=42
I tried to implement this captcha http://www.dracon.biz/captcha.php to a script But It seems really

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.