in reply to Re^3: UTF-8 webpage output from MySQL
in thread UTF-8 webpage output from MySQL

I lost my sanity over this a long time age...

I do not want to switch template system, I can't be the only one that is using H::T with utf-8?

I don't use the code below:

decode_utf8($tmpl->output);
it was just to show that if I did use it, my template files would display the reverse question mark sign instead of å,ä and ö. but my database data would display correct.

Replies are listed 'Best First'.
Re^5: UTF-8 webpage output from MySQL
by moritz (Cardinal) on Jan 22, 2008 at 14:11 UTC
    ... and I explained why - because you mix binary and text (upgraded) data.

    If you don't want to switch template systems (foolish IMHO, but it's your choice) you can still make sure that all input to HTML::Template is binary data, not upgraded text strings. And make sure that no IO layer tries to encode them once again.

    Or you can go the the bug tracker, and locally apply one of the two patches that add an open mode to HT.

    Is there a particular reason you want to stick to a broken(*) template system? You don't have to change a single line in your templates if you use one that emulates HT's syntax.

    (*): broken for this application. I once asked about Handling Encoding in Templates, and there was no viable solution offered for HTML::Template.

      ok, thanks for your input! I will look into all your responses and see if I can keep my sanity...