This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff 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 OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP 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: 424
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: 2674
    
    9

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 OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61993
    
  67

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: 424
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: 61993
    
  67

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spaces in word