New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fail on non ascii symbols #430
Comments
I'm not sure about the order of loading, but can't you toss the |
Why not? $Mojo::Template::code its evaluated code. nwtour@/tmp $ cat test.pl #!/usr/bin/env perl
sub gen_template {
my $u = shift;
return q{
package Mojo::Template::SandBox;
use Mojo::Base -strict;
} . ( $u ? 'use utf8;' : '' ) . q{
no warnings 'redefine';
use strict;
my $_S = undef; # $self->stash;
my $Файл = $_S->{'Файл'};
};
}
eval gen_template( 1 );
print "example one: " . ( $@ ? 'fail' : 'ok' ) . "\n";
eval gen_template( 0 ) ;
print "example two: " . ( $@ ? 'fail' : 'ok' ) . "\n";
nwtour@/tmp $ perl test.pl |
Can I ask you to please use markdown code formatting on your examples? Thanks. Here is my example: #!/usr/bin/env perl
use strict;
use warnings;
use Mojo::Template;
my $t = Mojo::Template->new(
prepend => 'use utf8;',
);
my $rendered = $t->render( <<'END' );
% my $Файл = 'Файл';
%= $Файл
END
# prevent "wide character" warning
use open qw{:encoding(UTF-8) :std};
print $rendered; This seems to run just fine. Further, putting |
Markdown done (Sorry i`m noobie on github) This bug depended on perl compile options, on my home computer bug unreproduced (work in the box), but I compile vanila perl with default options and bug returned. probably cause:
About "prepend" - now i`m understand. Its cool and its work! But i dont find place to patch Mojolicious::Plugin::Toto Subject bug in line 324: https://metacpan.org/source/BDUGGAN/Mojolicious-Plugin-Toto-0.21/lib/Mojolicious/Plugin/Toto.pm#L324 Stash key as utf8 string IMHO its normal situation, agree? |
I'm wondering if this would be fixed by 34d8bfa ? |
Yeah! utf8->import by default! |
Yes! Patch from 34d8bfa resolve this issue. Many thanks Joel and Sebastian. |
Code (used toto framework, body russian UTF-8):
On request:
[Tue Dec 18 22:08:10 2012] [fatal] Processing request failed: Can't use global$^þ¿¿¿¾Â¤Ã°Ã¹Ã» in "my" at inline template line 1, near "my $ Файл "
Patch (workaround?):
Thanks you!
The text was updated successfully, but these errors were encountered: