Re: How to use UtF-8 characters in Petal Templates
Peter Mayr <[email protected]> Thu, 27 Sep 2012 15:55:02 +0200
| Newsgroups | gmane.comp.lang.perl.modules.petal |
|---|---|
| Message-ID | <[email protected]> |
Hi, thanks very much for our helpful answer! Am 27.09.2012 15:05, schrieb Stefan Seifert: > Your issue is not with Petal, but with Perl in general. I see, I was a bit confused because I saw the Entity-Translation in=20 Petal::Entities in a - what looked to my emacs like a - iso-latin-1 file. But of course, you are right, that has nothing to do with how it is=20 eventually spit out by perl. $Template->process() > gives you a Perl Unicode character string. It's your responsibility to = encode > it according to your needs (that would be UTF-8) on output. Simply doin= g a > print in your test script will encode the character string to the platf= orm > encoding (usually latin-1). > > Same would happen if you just printed some constant Unicode string: > perl -E 'use utf8; say "=C3=B6d=C3=B6g=C3=B6d=C3=B6ck=C3=B6";' > > To get UTF-8 output, you could use binmode: > perl -E 'use utf8; binmode STDOUT, ":utf8"; say "=C3=B6d=C3=B6g=C3=B6d=C3= =B6ck=C3=B6";' Great that works for me. > Have a look at https://metacpan.org/module/perluniintro for further > information about how to use Unicode in Perl. And remember: debugging > character encoding problems _sucks_ Yes, I already found out about that... Thanks again, regards Peter --=20 Peter Mayr, MA LIS hbz, Gruppe Portale - DigiBib, Online-Fernleihe - Postfach 270451, 50510 K=C3=B6ln, Deutschland Telefon +49-221-40075-198, Fax +49-221-40075-190 [email protected] http://www.hbz-nrw.de