Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spaces in word

 
Isaac DurĂ¡
Ranch Hand
Posts: 859
2
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3502
14
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to URL-encode values in URLs. The space will be turned into a +, or the hex equivalent.
 
Isaac DurĂ¡
Ranch Hand
Posts: 859
2
Java Netbeans IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
 
varshika krish
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm also try can not done it's may be Google Analytic
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic