Skip Menu |

This queue is for tickets about the Mason CPAN distribution.

Report information
The Basics
Id: 67353
Status: new
Priority: 0/
Queue: Mason

Owner: Nobody in particular
Requestors: jozef.mojzis [...]

Bug Information
Severity: Important
Broken in: 2.06
Fixed in: (no value)

Subject: Mason components in utf8 environment
Download (untitled) / with headers
text/plain 1.2k
Currently is not possible to use Mason fully in utf8 environment. For example: % my $name="ÖDÖN"; <h2>Hello, <% ucfirst(lc( $name )) %>. Welcome to my čača blog.</h2> For ucfirst, lc, regexes and so on you need to specify "use utf8". However, then psgi throws an error. So the only way write the above is: % use utf8; % use Encoding; % my $name="ÖDÖN"; <h2>Hello, <% encode_utf8(ucfirst(lc( $name ))) %>. Welcome to my <% encode_utf8("čača") %> blog.</h2> encoding every string in every component is terrible. So need write a filter, and use it like % use utf8; <% $.EncodeUtf8 { %> <h2>Hello, <% ucfirst(lc( $name )) %>. Welcome to my čača blog.</h2> </%> less terrible, but still... Therefore, for the using Mason in utf8 environment the distribution it should contain an default plugin like Mason::Plugin::UTF8 or so, for easy UTF8 handling. The plugin should: a.) insert the "use utf8;" into the top of every component b.) somewhere encode_utf8 all content c.) and probably here are other issues, like correct form handling and so on.. Without such plugin, using Mason AS FRAMEWORK in utf8 environment is really hard. I'm wrote something (based on default plugins) for the quick-fix, but honestly I haven't any idea what is the correct way make Mason really utf8 safe. jm
text/x-perl 434b
package Mason::Plugin::UTF8::Compilation; BEGIN { $Mason::Plugin::UTF8::Compilation::VERSION = '0.01'; } use Mason::PluginRole; override 'output_class_header' => sub { my $self = shift; #this is terrible - need some universal easy way inserting a perl-code to the top of every #component without writing a plugin. (maybe exists an simple way, but don't know how) return(super() . 'use utf8;use Encoding;'); }; 1;
text/x-perl 316b
package Mason::Plugin::UTF8::Request; #based on for Mason::Plugin::Defer::Request BEGIN { $Mason::Plugin::UTF8::Request::VERSION = '0.01'; } use Mason::PluginRole; use Encode; before 'flush_buffer' => sub { my $self = shift; ${ $self->_request_buffer } = encode_utf8( ${ $self->_request_buffer } ); }; 1;
text/x-perl 118b
package Mason::Plugin::UTF8; BEGIN { $Mason::Plugin::UTF8::VERSION = '0.01'; } use Moose; with 'Mason::Plugin'; 1;

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to