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 982513
In Process

The Archive Base Latest Questions

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

I need to replace all special control character in a string in Java. I

  • 0

I need to replace all special control character in a string in Java.

I want to ask the Google maps API v3, and Google doesn’t seems to like these characters.

Example: http://www.google.com/maps/api/geocode/json?sensor=false&address=NEW%20YORK%C2%8F

This URL contains this character: http://www.fileformat.info/info/unicode/char/008f/index.htm

So I receive some data, and I need to geocode this data. I know some character would not pass the geocoding, but I don’t know the exact list.

I was not able to find any documentation about this issue, so I think the list of characters that Google doesn’t like is this one:
http://www.fileformat.info/info/unicode/category/Cc/list.htm

Is there any already built function to get rid of these characters, or do I have to build a new one, with a replace one by one?

Or is there a good regexp to do the job done?

And does somebody know which exact list of characters Google doesn’t like?

Edit : Google have create a webpage for this :

https://developers.google.com/maps/documentation/webservices/?hl=fr#BuildingURLs

  • 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-16T04:42:34+00:00Added an answer on May 16, 2026 at 4:42 am

    If you want to delete all characters in Other/Control Unicode category, you can do something like this:

        System.out.println(
            "a\u0000b\u0007c\u008fd".replaceAll("\\p{Cc}", "")
        ); // abcd
    

    Note that this actually removes (among others) '\u008f' Unicode character from the string, not the escaped form "%8F" string.

    If the blacklist is not nicely captured by one Unicode block/category, Java does have a powerful character class arithmetics featuring intersection, subtraction, etc that you can use. Alternatively you can also use a negated whitelist approach, i.e. instead of explicitly specifying what characters are illegal, you specify what are legal, and everything else then becomes illegal.

    API links

    • java.util.regex.Pattern
    • regular-expressions.info/Character Class

    Examples

    Here’s a subtraction example:

        System.out.println(
            "regular expressions: now you have two problems!!"
                .replaceAll("[a-z&&[^aeiou]]", "_")
        );
        //   _e_u_a_ e___e__io__: _o_ _ou _a_e __o __o__e__!!
    

    The […] is a character class. Something like [aeiou] matches one of any of the lowercase vowels. [^…] is a negated character class. [^aeiou] matches one of anything but the lowercase vowels.

    [a-z&&[^aeiou]] matches [a-z] subtracted by [aeiou], i.e. all lowercase consonants.

    The next example shows the negated whitelist approach:

        System.out.println(
            "regular expressions: now you have two problems!!"
                .replaceAll("[^a-z]", "_")
        );
        //   regular_expressions__now_you_have_two_problems__
    

    Only lowercase letters a-z are legal; everything else is illegal.

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

Sidebar

Ask A Question

Stats

  • Questions 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer try it with this code: jQuery('#wl-poster-link').attr('href', href_path); jQuery('#poster-main-image').fadeOut('slow').attr('src',final_src); //wait till… May 17, 2026 at 12:13 am
  • Editorial Team
    Editorial Team added an answer Since the equivalent of PHP in java is jsp+servlets, here… May 17, 2026 at 12:13 am
  • Editorial Team
    Editorial Team added an answer I would recommend using ID instead of name, like: $("#myButton").attr("disabled",… May 17, 2026 at 12:13 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a string. In this string i need replace all special characters (0-31
I have a string. I need to replace all instances of a given array
I need to search a string and replace all occurrences of %FirstName% and %PolicyAmount%
I need to replace all minutes with hours in a file. Assume a raw
I need a function which takes an arbitrary number of arguments (All of the
I have to automate a program that is outside of my control. The way
Im trying to use http://www.javarants.com/2008/04/13/using-google-app-engine-to-extend-yahoo-pipes/ as inspiration, but I'm having some troubles with the
How can I replace characters with preg_replace , that are enclosed in quotes? I
I need to send HTML emails directly from oracle PL/SQL package. This works almost
I have a textfile which my Java program is modifying and putting into an

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.