On Monday 01 February 2010 16:09:03 Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 wrote: > >> open(TEMPLATE,"<:encoding(utf-8)", $filepath) > > > > лучше open(...,'<:utf8',...) > > это значительно быстрее > > … тоже значительно ошибочнее. Тебе всегда нужно использовать слой > > :encoding(UTF-8). Он – точный и рассказывает о проблемах; слой :utf8 > : молчает.
Not always. It I'm not interesting in this warnings, I use :utf8. It I trust the source, I'll use :utf8. In an example given, it's a templates, that was written by my own, so they are trusted. > > > perl -E'open my $fh, q(<:encoding(UTF-8)), q(broken-utf-8.txt); > <$fh>;' utf8 "\xE0" does not map to Unicode at -e line 1. > > perl -E'open my $fh, q(<:utf8), q(broken-utf-8.txt); <$fh>;' > > hex broken-utf-8.txt > 0000 d1 84 d1 83 d0 b1 d0 b0 d1 80 e0 d0 ba d0 b2 d1 ........ > ........ 0010 83 d0 ba d1 81 0a ...... > > Это может быть везти опасний ситуации: > <http://www.perlmonks.org/?node_id=644786> Thanks for the information. But in such a case an untainting is wrong, not an :utf8 layer. :utf8 have documented behaviour. -- Mons Anderson aka Vladimir Perepelitsa <[email protected]> / #99779956 / [email protected] -- Moscow.pm mailing list [email protected] | http://moscow.pm.org
