Encode vs encoding

[email protected] (Burak Gürsoy)
Newsgroups perl.unicode
Message-ID <[email protected]>
Hi to all list users.

Can someone *please* explain me the
difference between (except the scope) encoding and Encode::encode()?
I know encoding affects all the code, but what else does
it do to do the right thing or am I missing something with Encode?

I'm using ActivePerl 5.8.4 build 810 under Windows 2000
and here are the examples:


#!/usr/bin/perl -w
use strict;
my $char = "\xFE";
print ord $char; # prints 254

#!/usr/bin/perl -w
use strict;
use Encode;
my $char = "\xFE";
   $char = encode 'ISO-8859-9', $char;
print ord $char; # prints 63

#!/usr/bin/perl -w
use strict;
use Encode;
my $char = "\xFE";
   $char = encode 'ISO-8859-9', $char, Encode::FB_CROAK();
# dies with: "\x{00fe}" does not map to iso-8859-9
print ord $char;

#!/usr/bin/perl -w
use strict;
use encoding 'ISO-8859-9';
my $char = "\xFE";
print ord $char; # prints 351

How can I get that "351" with Encode.pm?

Note: If I use the letter version (small s with a dot under it "ş")
instead of the "\x" escape, I get the same results...
Note2: ISO-8859-9 == Turkish
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.