Posted by Carl Vondrick on 02/27/06 08:26
dbee wrote:
> dbee wrote:
>> So I can't seem to urlencode a file with newlines ... it just gives me
>> a series of T_STRING unexpected parse errors...
>>
>> cat job_description | while read file ; do php -r "echo
>> urlencode('$file');" ; done > job_description_encoded &&
>> URL_ENCODED_DESCRIPTION=`cat job_description_encoded`
>>
>> ... this takes in a job_description file and outputs a file with alot
>> of errors in the text ... ?
>
> So now I have this
>
> URL_ENCODED_DESCRIPTION="`cat job_description`"
>
> URL_ENCODED_DESCRIPTION=`php -r "echo
> rawurlencode('$URL_ENCODED_DESCRIPTION');"`
>
> echo "$URL_ENCODED_DESCRIPTION"
>
> ... which gives me a url_encoded output with spaces and linefeeds, but
> drops all newlines ... arrrrrrg ?
>
I do not think that newlines are supported. urlencode and rawurlencode
generate strings for being passed in URLs. Perhaps you should just do
your own escaping?
Navigation:
[Reply to this message]
|