in reply to Cannot preserve Latin 2 character sets in Perl

Perlmonks is buggy, and the local gods refuse to fix it, can't help with that. As for your actual question, you need to learn about the topic of encoding. Start by reading http://p3rl.org/UNI. The following program does what you expect.

use utf8;
use Encode qw(encode);
print encode 'UTF-8', 'Župljanin and Stanišić';

  • Comment on Re: Cannot preserve Latin 2 character sets in Perl

Replies are listed 'Best First'.
Re^2: Cannot preserve Latin 2 character sets in Perl
by PerlPksky (Initiate) on Sep 29, 2011 at 17:11 UTC

    That didn't work exactly, but I poked around a little and tried,

    use utf8;

    use Encode qw(encode);

    print encode 'iso-8859-2', 'Župljanin and Stanišić'."\n";

    And that worked. I should add that "use utf8;" has got to be there, it doesn't work without it.

    Thanks for the tip.