dmitryrusak has asked for the wisdom of the Perl Monks concerning the following question:

Hi, i have a string in utf-8 (containig russian text), i cannot figure out how to convert it to cyrillic (win-1251). I am working on perl 5.8 Any pointers? Thanx, Dmitry
  • Comment on How can i convert utf-8 string to cyrillic (win-1251)?

Replies are listed 'Best First'.
Re: How can i convert utf-8 string to cyrillic (win-1251)?
by thundergnat (Deacon) on May 24, 2005 at 13:18 UTC

    With the Encode module.

    use warnings; use strict; use Encode; my $string = 'A bunch of cyrillic characters that won\'t show up corre +ctly here.'; Encode::from_to($string, 'utf-8', 'cp1251'); # or whatever
      Thanx! It works!
Re: How can i convert utf-8 string to cyrillic (win-1251)?
by displeaser (Hermit) on May 24, 2005 at 13:22 UTC
      Unicode::String is obsolete, and, given 5.8 version of perl, those should *NOT* be recommended,

      --

        Didnt realise that. Thanks for the heads up.

        D