I found a solution, it seemed that I made a stupid mistake somewhere. But the following solution will work to preserve the original text in the edit field. Add the following to your parameter <param name="myparameter" type="text" area="true" size="40x80" label="sample parameter"> <sanitizer> <valid initial="default"> <add preset="string.printable"/> <remove value="""/> <remove value="\"/> <remove value=" "/> <remove value=" "/> <remove value="&"/> </valid> <mapping initial="none"> <add source="\" target="\\"/> <add source=""" target="\""/> <add source="&" target="&&"/> <add source=" " target="&n"/> <add source=" " target="&r"/> </mapping> </sanitizer> </param> I make use of to escape characters I use \ for \ and " and use & for the newline and carage return, because otherwise \n will reformatted to \\n once i get it inside ruby. Then I use the following code in ruby to decode it again def unescape(val) res = "" escape = false val.each_char do |char| if escape escape = false case char when '&' res += '&' when '\\' res += '\\' when 'n' res += "\n" when '\"' res += '\"' end else if char == '\\' || char == '&' escape = true else res += char end end end return res end If you want to preserve tabs you will have to add them, but example should be clear on how to do that.