Re: Encoding iso-8859-16

[email protected] (Nicholas Clark)
Newsgroups perl.unicode,perl.mvs,perl.perl5.porters,perl.beginners
Message-ID <[email protected]>
On Tue, Aug 09, 2005 at 10:58:48AM +0530, Sastry wrote:
> Hi
> 
> I get 73 printed on EBCDIC platform.  I think it is supposed to print 
> 129 as it is the numeric equivalent of 'a'.
> 
> -Sastry
> 
> 
> 
> On 8/8/05, Nicholas Clark <[email protected]> wrote:

> > On your EBCDIC platform, what does this give?
> > 
> >>>>>>> It prints 73 
> > use Encode;
> > $string = "a";
> > $enc_string = encode("iso-8859-16", $string);
> > 
> > print ord ($enc_string), "\n";

73. Odd.

It should print 97 on all platforms. Because:

$string contains 1 byte, the byte that represents 'a' in the platform's
default character encoding.

The encode call should convert from the default encoding to iso-8859-16
And 'a' in iso-8859-16 is 97.
Everywhere.

So $enc_string should be a single byte, 97, everywhere.

Nicholas Clark
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.