SYNOPSIS
use Catalyst qw[Unicode::Encoding];
MyApp->config( encoding => 'UTF-8' ); # A valid Encode encoding
DESCRIPTION
On request, decodes all params from encoding into a sequence of logical characters. On response, encodes body into encoding.METHODS
- encoding
-
Returns an instance of an "Encode" encoding
print $c->encoding->name
OVERLOADED METHODS
- finalize_headers
- Encodes body into encoding.
- prepare_uploads
- Decodes parameters, query_parameters, body_parameters and filenames in file uploads into a sequence of logical characters.
- prepare_action
- Decodes request arguments (i.e. "$c->request->arguments") and captures (i.e. "$c->request->captures").
- setup
- Setups "$c->encoding" with encoding specified in "$c->config->{encoding}".
- handle_unicode_encoding_exception ($exception_context)
-
Method called when decoding process for a request fails.
An $exception_context hashref is provided to allow you to override the behaviour of your application when given data with incorrect encodings.
The default method throws exceptions in the case of invalid request parameters (resulting in a 500 error), but ignores errors in upload filenames.
The keys passed in the $exception_context hash are:
-
- param_value
- The value which was not able to be decoded.
- error_msg
- The exception recieved from Encode.
- encoding_step
- What type of data was being decoded. Valid values are (currently) "params" - for request parameters / arguments / captures and "uploads" - for request upload filenames.
-
LICENSE
This library is free software . You can redistribute it and/or modify it under the same terms as perl itself.