[Comm] Re: Perl unicode

Stanislav Yadykin =?iso-8859-1?q?tosick_=CE=C1_altlinux=2Eru?=
Пт Окт 22 18:50:56 MSD 2004


В сообщении от Пятница, 22-Окт-2004 17:25 Alexey Tourbin написал(a):
> Лучше не использовать Text::Iconv вместе с нативным utf8.
> По крайней мере нижеследующее у меня не работает:
>
> $ perl -MText::Iconv -le 'my $text="текст"; utf8::encode $text; print Text::Iconv->new("utf8", "windows-1251")->convert($text)'

Ээээ... вообще-то

utf8::encode($string)
           Converts in-place the octets of the $string to the octet sequence in Perl's
UTF-X encoding.  Returns nothing.  Note that this does not change the "type" of
$string to UTF-8, and that this handles only ISO 8859-1 (or EBCDIC) as the source
character set. Therefore this should not be used to convert a legacy 8-bit encoding
to Unicode: use Encode::decode() for that.  

А вот если
-(~:$)-> perl "-MEncode('from_to')" -MText::Iconv -le 'my $text="текст"; from_to($text, "windows-1251", "utf8"); print Text::Iconv->new("utf8", "windows-1251")->convert($text)'
текст

> Может быть дело в том, что XML::Stream использует
> use open ':utf8'
Смотрел, но подобного ничего нет.

-- 
Stanislav Yadykin
ALT Linux Team
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 190 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/community/attachments/20041022/9af0b8df/attachment-0003.bin>


Подробная информация о списке рассылки community