xslate / p5-Text-Xslate

Scalable template engine for Perl5

Home Page:https://metacpan.org/release/Text-Xslate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

XSlate eats some text when in a macro

pleblancq opened this issue · comments

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>
:}

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

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.