[Catalyst] Tweaking REST

Christopher H. Laco claco at chrislaco.com
Tue Jan 30 15:13:10 GMT 2007


> There are still some issues with using views, mainly that they both
> fight of setting content-type...and since REST sets it already, the view
> never sets it, which is good, but also the charset=3Dutf isn't set either=
...

Just to solidify that statement...

__load_content_plugins sets the response content type to the strict
mapping itself sans the charset=3D part. Things like the TT view add the
charset=3Dutf-8 if not encoding is set, but it already is, but that gets
trashed between the two, making using REST + UTF-8 producing views a
pita at first, and setting content_encoding makes no difference in some
browsers.

Ultimately, doing this in the views template does the right thing:

> [% CALL c.response.content_type('text/html; charset=3Dutf-8') -%]

or

> [% CALL c.response.content_type('text/plain; charset=3Dutf-8') -%]


which imho is the better option, since each individual template
file/view may even use a different encoding...each view can tweak the
encoding, and not rely in the magic inner workings of REST when using views.

-=3DChris

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070130/92d8=
d57d/signature.pgp


More information about the Catalyst mailing list