Sunday, 18 August 2013

Perl - How to solve the trouble with encoding in windows console?

Perl - How to solve the trouble with encoding in windows console?

Trying to use russian lettaz and console acts like a donkey, because does
not react on use utf8/utf-8 or cp1251 directives. What the encoding of the
text marked by red colour I don't know. Anybody knows how to solve that ?
Code listing below:
#!/usr/bin/perl -w
use strict;
use warnings;
use Tie::IxHash;
use encoding 'utf8';
tie my %hash, "Tie::IxHash";
%hash = (
'øëÿïà' => 'ñåðàÿ',
'âîäêà' => 'ãîðüêàÿ',
'âîáëà' => 'âêóñíàÿ');
print " óïîðÿäî÷åííîé âñòàâêå ñïèñîê õåøà òàêîé:\n";
foreach my $qwerty (keys %hash){
print " $qwerty\n";
}
print "Êðîìå òîãî, ïðåäìåòû îáëàäàþò íåêîòîðûìè ñâîéñòâàìè:\n";
while((my $predmet, my $opredelenie) = each %hash){
print $predmet $opredelenie,"\n";
}

No comments:

Post a Comment