X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FUTF8.pod;h=b32bc31a3e340cd7dd655b801120dc39d8fd950a;hp=9f2ceed68bb88cc81749132268f368a9550b3350;hb=473078ffb70c9a5585a6b190fc973f5e9000c11b;hpb=5fa5b709e0d80a7cc43694c3513666de2de4390d diff --git a/lib/Catalyst/UTF8.pod b/lib/Catalyst/UTF8.pod index 9f2ceed..b32bc31 100644 --- a/lib/Catalyst/UTF8.pod +++ b/lib/Catalyst/UTF8.pod @@ -32,7 +32,7 @@ as well as how you construct L objects to actions with UTF8 paths package MyApp::Controller::Root; - use uf8; + use utf8; use base 'Catalyst::Controller'; sub heart_with_arg :Path('♥') Args(1) { @@ -60,7 +60,7 @@ In the example controller above we have constructed two matchable URL routes: The first one is a classic Path type action and the second uses Chaining, and spans three actions in total. As you can see, you can use unicode characters -in your Path and PartPart attributes (remember to use the C pragma to allow +in your Path and PathPart attributes (remember to use the C pragma to allow these multibyte characters in your source). The two constructed matchable routes would match the following incoming URLs: @@ -133,7 +133,7 @@ pragma). use utf8; my $url = $c->uri_for( $c->controller('Root')->action_for('arg'), ['♥','♥']); -When you stringyfy this object (for use in a template, for example) it will automatically +When you stringify this object (for use in a template, for example) it will automatically do the right thing regarding utf8 encoding and url encoding. http://localhost/base/%E2%99%A5/%E2%99%A5/%E2%99%A5/%E2%99%A5 @@ -148,9 +148,8 @@ What Catalyst does with UTF8 in your GET and classic HTML Form POST =head2 UTF8 in URL query and keywords -The same rules that we find in URL paths also cover URL query parts. That is if -one types a URL like this into the browser (again assuming a modernish UI that -allows unicode) +The same rules that we find in URL paths also cover URL query parts. That is +if one types a URL like this into the browser http://localhost/example?♥=♥♥ @@ -186,7 +185,7 @@ strings) in $c->uri_for: use utf8; my $url = $c->uri_for( $c->controller('Root')->action_for('example'), {'♥' => '♥♥'}); -When you stringyfy this object (for use in a template, for example) it will automatically +When you stringify this object (for use in a template, for example) it will automatically do the right thing regarding utf8 encoding and url encoding. http://localhost/example?%E2%99%A5=%E2%99%A5%E2%99%A5 @@ -355,7 +354,7 @@ B pay attention to the content-type setting in the example. L i content type carefully to determine if the body needs encoding). B If you set the character set of the response L will skip encoding IF the -character set is set to somethng that doesn't match $c->encoding->mime_name. We will assume +character set is set to something that doesn't match $c->encoding->mime_name. We will assume if you are setting an alternative character set, that means you want to handle the encoding yourself. However it might be easier to set $c->encoding for a given response cycle since you can override this for a given response. For example here's how to override the default @@ -402,7 +401,7 @@ L will encode each line in turn as long as the content-type meets the requirement and $c->encoding is set (which it is, as long as you did not change it). B If you try to change the encoding after you start the stream, this will invoke an error -reponse. However since you've already started streaming this will not show up as an HTTP error +response. However since you've already started streaming this will not show up as an HTTP error status code, but rather error information in your body response and an error in your logs. The second way to stream a response is to get the response writer object and invoke methods @@ -417,7 +416,7 @@ on that directly: $writer->close; } -This can be used just like the C method, but typicallty you request this object when +This can be used just like the C method, but typically you request this object when you want to do a nonblocking style response since the writer object can be closed over or sent to a model that will invoke it in a non blocking manner. For more on using the writer object for non blocking responses you should review the C documentation and also @@ -455,7 +454,7 @@ check the current docs and changelog. Its possible a future release will requir a encoding on the IO layer level so that we can be sure to properly encode at body finalization. So this is still an edge case we are writing test examples for. But for now if you are returning a filehandle like response, you are expected to make sure you are following the L specification -and that unencoded bytes are returned. +and return raw bytes. =head2 Override the Encoding on Context