seuratt has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that Twig dutifully undoes this escaping unless I turn keep_encoding on. That option, as warned in the docs, doesn't work so well. It leaves html escaped and seems to double escaped the unicode.
The documentation of Twig explains that, even with output_encoding set, the values of any text() or attr() functions are utf8. I have considered converting at every single element access, but this is maybe 50 or so points in my code and makes these dense functions denser.
I've considered just rendering my browser page and then applying a convert to the entire string, but it is even harder to do once the utf8 variables are substituted into latin-1 templates. So I guess my question is: does anyone know of an easier way? I'll likely end up going through and doing that convert at every call to Twig::Elt->text() and attr(), but I'd really rather not.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML, Twig, and character encoding
by mirod (Canon) on Mar 09, 2005 at 17:00 UTC |