sxml-transforms encoding bug? added by andyjpb on Mon Sep 2 20:55:38 2013

(use sxml-transforms)

(define html-rules `((literal *preorder* . ,(lambda (t b) b))
		     . ,universal-conversion-rules*))

(define (sxml->html sxml)
    (SRV:send-reply (pre-post-order* sxml html-rules)))


#;3> (sxml->html '(div (div hello)))

<div>
<div>hello</div></div>#t

#;4> (sxml->html '(textarea (div hello)))
<textarea>
<div>hello</div></textarea>

...but <textarea> is defined as containing only PCDATA whereas <div> contains %flow:

http://www.w3.org/TR/html401/interact/forms.html#h-17.7

http://www.w3.org/TR/html4/struct/global.html#edef-DIV

so I'd expect something like

#;6> (sxml->html `(textarea ,(with-output-to-string (lambda () (sxml->html '(div hello))))))
<textarea>
&lt;div&gt;hello&lt;/div&gt;</textarea>


edge cases:

#;10> (sxml->html '(textarea (div (@ (hello "\"what\"")))))
<textarea>
<div hello="&quot;what&quot;"></div></textarea>

... is irreversible because the browser will map " to " and &quot; to " as well.


#;12> (sxml->html `(textarea ,(with-output-to-string (lambda () (sxml->html '(div (@ (hello "\"what\""))))))))
<textarea>
&lt;div hello=&quot;&amp;quot;what&amp;quot;&quot;&gt;&lt;/div&gt;</textarea