[PHP] urlencode() and newlines?
hello all, For reasons beyond my immediate control i have to keep some strings of text in a text *new line delimited* text file. I also have to urlencode those strings for use in my script. Like this: ## text file This is a line\nThis is another line This is another string\nwith some more\nnew lines Problem is, that urlencoding those lines doesnt seem to work well the the \n's - when they get to where they are going (another server, not in my control) the new lines are no longer there... Can anyone tell me how to get round this issue without storing the strings in another way? - many thanks! ;-) -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] urlencode() and newlines?
Nick Wilson wrote: hello all, For reasons beyond my immediate control i have to keep some strings of text in a text *new line delimited* text file. I also have to urlencode those strings for use in my script. Like this: ## text file This is a line\nThis is another line This is another string\nwith some more\nnew lines Problem is, that urlencoding those lines doesnt seem to work well the the \n's - when they get to where they are going (another server, not in my control) the new lines are no longer there... Can anyone tell me how to get round this issue without storing the strings in another way? - many thanks! ;-) Because what you are doing is not urlencoding. Try echo urlencode(This is a line\nThis is another line); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] urlencode() and newlines?
* and then Marek Kilimajer declared Nick Wilson wrote: hello all, For reasons beyond my immediate control i have to keep some strings of text in a text *new line delimited* text file. I also have to urlencode those strings for use in my script. Like this: ## text file This is a line\nThis is another line This is another string\nwith some more\nnew lines Problem is, that urlencoding those lines doesnt seem to work well the the \n's - when they get to where they are going (another server, not in my control) the new lines are no longer there... Can anyone tell me how to get round this issue without storing the strings in another way? - many thanks! ;-) Because what you are doing is not urlencoding. Try echo urlencode(This is a line\nThis is another line); Yep, i can see that it's encoded but when the data is POSTed to a form, it does not come out as a newline... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] urlencode() and newlines?
Nick Wilson wrote: * and then Marek Kilimajer declared Nick Wilson wrote: hello all, For reasons beyond my immediate control i have to keep some strings of text in a text *new line delimited* text file. I also have to urlencode those strings for use in my script. Like this: ## text file This is a line\nThis is another line This is another string\nwith some more\nnew lines Problem is, that urlencoding those lines doesnt seem to work well the the \n's - when they get to where they are going (another server, not in my control) the new lines are no longer there... Can anyone tell me how to get round this issue without storing the strings in another way? - many thanks! ;-) Because what you are doing is not urlencoding. Try echo urlencode(This is a line\nThis is another line); Yep, i can see that it's encoded but when the data is POSTed to a form, it does not come out as a newline... Are you sure the other side accepts, does not remove newlines? Create a form with textarea that posts to the server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] urlencode() and newlines?
* and then Marek Kilimajer declared echo urlencode(This is a line\nThis is another line); Yep, i can see that it's encoded but when the data is POSTed to a form, it does not come out as a newline... Are you sure the other side accepts, does not remove newlines? Create a form with textarea that posts to the server yeah, i guess i'll have to, thanks Marek.. -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php