Re: PHP inserting carriage returns into POST values?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 04 Sep 2009 12:16:47 -0700, James Colannino wrote:

> Hey everyone.  I ran into a really weird issue that I was hoping I could
> find some clarification on.  In short, I have javascript functions that
> operate on hidden text values.  Those values may be posted, in which
> case PHP then prints them back to the page via what comes in on $_POST.
> 
> The weird thing is, I was no longer able to match substrings inside
> those hidden text values after posting via Javascript.  I banged my head
> over this for a couple hours, until I realized that the string's length
> was being increased by one after posting (I found this out in
> javascript).  Upon further investigation, I found that all instances of
> "substring\n" were being replaced by "substring(carriage return)\n"
> after post.

It may be the browser that is converting those line breaks.
>From the HTML spec.:


<http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1>:

    application/x-www-form-urlencoded
    ...
    Line breaks are represented as "CR LF" pairs (i.e., `%0D%0A').


<http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2>:

    multipart/form-data
    ...
    "CR LF" (i.e., `%0D%0A') is used to separate lines of data.


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux