xslate / p5-Text-Xslate

Scalable template engine for Perl5
https://metacpan.org/release/Text-Xslate
Other
121 stars 47 forks source link

XSlate eats some text when in a macro #123

Open pleblancq opened 10 years ago

pleblancq commented 10 years ago

ex:

: macro ly_header_test -> {
    <p><: $lg.header_test :></p>
    <script>
        $('#test img').attr('src','<: $url_microsite :>images/logo_test<: $fm.lg :>.gif');
    </script>
:}

for the first few runs, 'src', will be chopped off. if you refresh the page after a couple of time, everything is fine. So if the webpage outputs language other than english (french in my case), all the accentued characters will be in the wrong encoding.

but if you change the macro to look like this, it will work.

: macro ly_header_test -> {
    <script>
        $('#test img').attr('src','<: $url_microsite :>images/logo_test<: $fm.lg :>.gif');
    </script>
    <p><: $lg.header_test :></p>
:}
gfx commented 10 years ago

Thanks to the report. Can you make a test case for it?

pleblancq commented 10 years ago

I'll gladly do one when things calm down at job ! By the way, it happens only when there's utf8 characters. The development machine also uses an old perl version (5.8.8) which I believe is not utf8 friendly.

I know that Xslate is expecting to receive utf8 only, but what happen if encoding gets mixed up ? Could it be problematic ? I'm really short of time right now to go deep in Xslate guts.

Thanks for answering.