Perl Encode - UK characters

Posted by Phill Pafford on Stack Overflow See other posts from Stack Overflow or by Phill Pafford
Published on 2010-06-15T15:26:03Z Indexed on 2010/06/15 16:52 UTC
Read the original article Hit count: 314

Filed under:
|
|

This is a part 2 question from This Question.

So I'm trying out the :encode functionality but having no luck at all.

use Encode;
use utf8;

# Should print: iso-8859-15
print "Latin-9 Encoding: ".find_encoding("latin9")->name."\n"; 

my $encUK = encode("iso-8859-15", "UK €");
print "Encoded UK: ".$encUK."\n";

Results:

Encoded UK: UK €

Shouldn't the results be encoded? what am I doing wrong here?

EDIT:

Added the suggested:

use utf8;

and now I get this:

Encoded UK: UK ?

pulling hair out now :/

© Stack Overflow or respective owner

Related posts about perl

Related posts about encode