Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rails escapes quotes at when they are at beginning and and of signle-line string

#4576

When there are quotes at the begining and at the end of a textarea rails escapes them, and stores string without quotes. It's not happen with multiline strings.
For example given to textarea declerated as <%= f.text_area :name %>
the text: "Test Scenario"
and I will got:
Parameters: {"commit"=>"Submit", "authenticity_token"=>"YtwwTBw3pyniVxBzHVU5j5ZZ/nouhUqqm1iU59J0W68=", "test"=>{"name"=>"Test scenario"}}

text: "Test
Scenario"
Will produce paramterers with quotes stored
Parameters: {"commit"=>"Submit", "authenticity_token"=>"YtwwTBw3pyniVxBzHVU5j5ZZ/nouhUqqm1iU59J0W68=", "test"=>{"name"=>""Test \r\nScenario""}}

Reported by nkuba · May 11th, 2010 @ 01:28 PM

State: wontfix
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Ryan Bigg
    Ryan Bigg
    • Tag changed from escaping, quotes, textarea to bugmash, escaping, quotes, textarea
    • State changed from new to incomplete

    Please provide a failing test case and patch for this issue.

    May 13th, 2010 @ 11:46 PM

  2. Rohit Arondekar
    Rohit Arondekar

    The same problem happens with text_field also.

    May 14th, 2010 @ 07:12 AM

  3. Neeraj Singh
    Neeraj Singh
    • Tag changed from bugmash, escaping, quotes, textarea to bugmash, escaping, quotes, rails3, textarea

    This is not a rails issue.

    Rails is exhibiting this behavior because rack is doing all the work of converting user input in params. Take a look at this test case in rack. http://github.com/rack/rack/blob/master/test/spec_rack_utils.rb#L35 . rack is coded to remove the double quotes which the author of ticket does not want.

    If you add a new line character then double quotes is preserved. http://github.com/neerajdotname/rack/commit/1454a2171032e2260dc7199...

    I have posted a question on the rack mailing list about this issue. When a resolution comes I will update this issue.

    May 14th, 2010 @ 05:09 PM

  4. Ryan Bigg
    Ryan Bigg
    • Tag changed from bugmash, escaping, quotes, rails3, textarea to escaping, quotes, rails3, textarea

    May 15th, 2010 @ 11:12 AM

  5. Ryan Bigg
    Ryan Bigg
    • State changed from incomplete to wontfix

    Not a rails bug, but a Rack one.

    May 15th, 2010 @ 11:40 AM

  6. andreas
    andreas

    Dupe: #4808 Textarea input silently truncated in 2.3.8!

    Rails still requires the broken rack version, this should be fixed ASAP

    July 27th, 2010 @ 08:45 PM