This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes General Computing and the fly likes Spaces in word Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Spaces in word" Watch "Spaces in word" New topic
Author

Spaces in word

Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 331
Hi,

I am trying to send a query to Google Analytics but when I send the word like "United Kingdom". Google launch an error because the blank space. I need send it as one unique word. Do you know any wrapper or something like that?.

Any idea?

Thanks
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2229
    
    7

How do the URLs with spaces work? They replace them with the hex equivalent of space I think.

I'm not sure about Google Analytics, you might want to check their docs.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60749
    
  65

You need to URL-encode values in URLs. The space will be turned into a +, or the hex equivalent.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Isaac Ferguson
Ranch Hand

Joined: Jun 22, 2012
Posts: 331
For example if my query contains:


country=="United Kingdom"


And after that I use;


URL optimizedQuery = new URL(query);

That's what I am doing what more I need, please?

Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60749
    
  65

java.net.URLEncoder
varshika krish
Greenhorn

Joined: Dec 06, 2012
Posts: 5
i'm also try can not done it's may be Google Analytic
 
 
subject: Spaces in word
 
Similar Threads
translate from English to Hindi
Matching pattern in given list
Beta Part II submission acknowledgement
how to build java word wheel
Build Word Wheel in Java