Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to insert %20 in place of space in android

I have a xml URL file in which there are white spaces i want to replace white spaces with %20.. how to do this????

SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader();  /** Send URL to parse XML Tags */ URL sourceUrl = new URL(                 "http://www.arteonline.mobi/iphone/output.php?gallery=MALBA%20-%20MUSEO%20DE%20ARTE%20LATINOAMERICANO%20DE%20BUENOS%20AIRES");  XMLHandlerartistspace myXMLHandler = new XMLHandlerartistspace(); xr.setContentHandler(myXMLHandler); xr.parse(new InputSource(sourceUrl.openStream())); 
like image 884
SRam Avatar asked May 18 '11 13:05

SRam


People also ask

How do you type half space on Android?

i write my text in notepad with semi-space (CTRL+SHIFT+2) then copy that to Android Studio. Show activity on this post. If Shift + Space didn't work use Shift + B. It's the same.

How do you put a space in XML?

As already mentioned the correct way to have a space in an XML file is by using \u0020 which is the unicode character for a space.


1 Answers

Try this:

String temp = http://www.arteonline.mobi/iphone/output.php?gallery=MALBA%20-%20MUSEO%20DE%20ARTE%20LATINOAMERICANO%20DE%20BUENOS%20AIRES  temp = temp.replaceAll(" ", "%20"); URL sourceUrl = new URL(temp); 
like image 125
Sumant Avatar answered Oct 08 '22 00:10

Sumant