1.1 --- a/docs/responses.html Wed Feb 28 19:49:11 2007 +0000
1.2 +++ b/docs/responses.html Wed Feb 28 22:31:10 2007 +0000
1.3 @@ -33,7 +33,12 @@
1.4 <p>The kind of code involved may
1.5 well resemble the following:</p>
1.6 <pre>from WebStack.Generic import ContentType<br /><br />class MyResource:<br /> def respond(self, trans):<br /> [Perform the requested operations.]<br /><br /> if [the operation was successful]:<br /> trans.set_response_code(200)<br /> trans.set_content_type(ContentType("text/html", encoding="utf-8"))<br /> out = trans.get_response_stream()<br /> out.write([some data either as a plain string suitably encoded or as Unicode])<br /> else:<br /> trans.set_response_code(500) # or some other code<br /> trans.set_content_type(ContentType("text/html", encoding="utf-8"))<br /> out = trans.get_response_stream()<br /> out.write([some other data either as a plain string suitably encoded or as Unicode])</pre>
1.7 -<p>As discussed in <a href="encodings.html">"Character Encodings"</a>,
1.8 +<h2>Unicode and the Response Stream</h2><p>Although an encoding may be specified or be set as a default by the <code>EncodingSelector</code> (see <a href="selectors.html">"Selectors - Components for Dispatching to Resources"</a>),
1.9 +it should be noted that the encoding of textual information will only
1.10 +take place if Unicode objects are written to the stream. Where binary
1.11 +information or information which should not be changed is being
1.12 +written, this must be supplied as plain strings to the transaction
1.13 +object's <code>write</code> method.</p><p>As discussed in <a href="encodings.html">"Character Encodings"</a>,
1.14 care
1.15 must be taken generating the response so that it meets any expectations
1.16 that