Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-07-2010, 05:04 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 10
Red face Sending URL Gets with spaces to php page problem

In my app, a user clicks a cell to view a detail screen which pulls information from a php page that generates xml. Everything is working great, except for the table cell's values that have spaces in it.

When there is a space, the value is still sent to the detail page, and sent to the php page, but it doesn't show up correctly. When I type the value into the php and use the app to send any information then it works great.

Is there a piece of coding I type in the app to make the submitted value a certain type, like unicode? Or can I type something in the php page that will translate it into normal text? I've been searching for hours, but I just don't know what to search for to find this answer.

Please help!
tateyaku is offline   Reply With Quote
Old 02-07-2010, 05:12 PM   #2 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 24
Default

I don't know a lot about PHP, but try if it helps to enter

utf8_encode($String)

into the PHP file....
seb_bue is offline   Reply With Quote
Old 02-07-2010, 05:40 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 10
Default I tried, but to no avail

Quote:
Originally Posted by seb_bue View Post
I don't know a lot about PHP, but try if it helps to enter

utf8_encode($String)

into the PHP file....
I tried it, but it didn't work
tateyaku is offline   Reply With Quote
Old 02-07-2010, 06:37 PM   #4 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 24
Default

How are you sending the data to the PHP script?
seb_bue is offline   Reply With Quote
Old 02-08-2010, 12:37 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 10
Default

Quote:
Originally Posted by seb_bue View Post
How are you sending the data to the PHP script?
Code:
//value works with no spaces, but does not work with spaces
NSString *sortedBy = @"value"; 
	NSString *url = [[NSString alloc] initWithFormat:@"http:domain/page.php?sortedBy=%@&viewBy=%@", sortedBy, viewBy];
	NSURL *path = [NSURL URLWithString:url];
	[url release];
	
	NSMutableDictionary *d = [[NSDictionary alloc] initWithContentsOfURL:path];
	self.viewInfo = d;
	[d release];
tateyaku is offline   Reply With Quote
Old 03-22-2011, 02:49 AM   #6 (permalink)
Mishti
 
Join Date: Mar 2011
Location: Mumbai
Posts: 28
Default

Quote:
Originally Posted by tateyaku View Post
In my app, a user clicks a cell to view a detail screen which pulls information from a php page that generates xml. Everything is working great, except for the table cell's values that have spaces in it.

When there is a space, the value is still sent to the detail page, and sent to the php page, but it doesn't show up correctly. When I type the value into the php and use the app to send any information then it works great.

Is there a piece of coding I type in the app to make the submitted value a certain type, like unicode? Or can I type something in the php page that will translate it into normal text? I've been searching for hours, but I just don't know what to search for to find this answer.

Please help!


HIIIII
I am also facing same problem. If u got any solution plz discuss with me.


Thanxxxxxxxxxxxxxx
mishti is offline   Reply With Quote
Old 03-22-2011, 04:01 AM   #7 (permalink)
Indie Developer
 
iSDK's Avatar
 
Join Date: Jul 2010
Posts: 1,333
Send a message via AIM to iSDK
Default

You need to use the stringByReplacingPercentEscapesUsingEncoding:NSUTF 8StringEncoding function.
Quote:
Originally Posted by tateyaku View Post
In my app, a user clicks a cell to view a detail screen which pulls information from a php page that generates xml. Everything is working great, except for the table cell's values that have spaces in it.

When there is a space, the value is still sent to the detail page, and sent to the php page, but it doesn't show up correctly. When I type the value into the php and use the app to send any information then it works great.

Is there a piece of coding I type in the app to make the submitted value a certain type, like unicode? Or can I type something in the php page that will translate it into normal text? I've been searching for hours, but I just don't know what to search for to find this answer.

Please help!
iSDK is offline   Reply With Quote
Reply

Bookmarks

Tags
app, apple, code, iphone, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 249
21 members and 228 guests
@sandris, ADY, bookesp, ckgni, dacapo, Dani77, DarkAn, Davey555, Desert Diva, HemiMG, iDifferent, jakerocheleau, JasonR, LEARN2MAKE, prchn4christ, Rudy, ryantcb, Speed, themathminister, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,766
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:41 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0