Browse files

Added an FAQ entry about Unicode

  • Loading branch information...
miyagawa committed Jun 18, 2010
1 parent 215e046 commit c9c2c76f96ee71861498b2ce7b900881e73bf64e
Showing with 19 additions and 0 deletions.
  1. +19 −0 PSGI/FAQ.pod
@@ -360,6 +360,25 @@ backends simple. Other options, like allowing an array ref
in addition to a plain scalar, make either side of the code
unnecessarily tedious.
+=head3 I want to send Unicode content in the HTTP response. How can I do so?
+PSGI mocks wire protocols like CGI, and the interface doesn't care too
+much about the character encodings and string semantics. That means,
+all the data on PSGI environment values, content body etc. are sent as
+byte strings, and it is an application's responsibility to properly
+decode or encode characters such that it's being sent over HTTP.
+If you have a decoded string in your application and want to send them
+in C<UTF-8> as an HTTP body, you should use L<Encode> module to encode
+it to utf-8. Note that if you use one of PSGI-supporting frameworks,
+chances are that they allow you to set Unicode text in the response
+body and they do the encoding for you. Check the documentation of your
+framework to see if that's the case.
+This design decision was made so it gives more flexibility to PSGI
+applications and frameworks, without putting complicated work into
+PSGI web servers and interface specification itself.
=head3 No iterators support in $body?
We learned that WSGI and Rack really enjoy the benefit of Python and

0 comments on commit c9c2c76

Please sign in to comment.