pack-unicode problem (z/OS)

2005-03-11 Thread Rajarshi Das
Hi,
I am running perl 5.8.6 on z/OS unix. I am doing these :
$u = unpackU0U, \x8a\x73;
print \n\$u : $u;
$p = pack(U0U, $u);
print \n\$p : $p;
This intuitively suggests that $p should be set to the chars \x8a and \x73. 
But that isnt the case. Instead I get the char \x59.

Alternately,
If I replace \x8a\x73 by \x8E\x4A,
$p is set to \x8E\x4A as expected.
In the first case, $u is set to 223 (less than 255)
In the second, $u is set to 329 (255)
Could this be the reason for the problem ?
Is there a way to figure out if pack has a problem (as in $u is set wrongly) 
so that unpack gives a different value than expected, or,
Is unpack failing (and pack's working properly) ?

Thanks in advance,
Rajarshi.
_
News, views and gossip. http://www.msn.co.in/Cinema/ Get it all at MSN 
Cinema!

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: pack-unicode problem (z/OS)

2005-03-11 Thread Dave Gray
 I am running perl 5.8.6 on z/OS unix. I am doing these :
 
 $u = unpackU0U, \x8a\x73;
 print \n\$u : $u;
 
 $p = pack(U0U, $u);
 print \n\$p : $p;

Are you running with strict and warnings turned on? Because I'm
getting Malformed UTF-8 character messages running this:

  #!/usr/bin/perl
  use strict;
  use warnings;

  my $u = unpackU0U, \x8a\x73;
  print \$u: $u\n;

  my $p = pack(U0U, $u);
  print \$p: $p\n;

And I can get rid of those errors by changing the pack/unpack template
to UU or U*... What are you trying to accomplish with U0U?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response