It does look like a Unicode issue. On the machine where I was having trouble, $LANG 
was:
 
en_US.UTF-8
 
Removing UTF-8 from $LANG eliminates the problem:
 
$ env LANG=en_US perl -e 'print pack("H*","208010")' | od -Ax -tx1
000000 20 80 10
000003
 
Thank you so much for pointing me to the source of the problem.
 
Youssef Eldakar
Bibliotheca Alexandrina

        -----Original Message----- 
        From: Randy W. Sims [mailto:[EMAIL PROTECTED] 
        Sent: Sun 7/11/2004 9:55 PM 
        To: Youssef Eldakar 
        Cc: [EMAIL PROTECTED] 
        Subject: Re: Packing a Hexadecimal String
        
        

        Youssef Eldakar wrote:
        > I am running Perl 5.8.0 on Linux.
        >
        >       -----Original Message-----
        >       From: Randy W. Sims [mailto:[EMAIL PROTECTED]
        >       Sent: Sun 7/11/2004 11:01 AM
        >       To: Youssef Eldakar
        >       Cc: [EMAIL PROTECTED]
        >       Subject: Re: Packing a Hexadecimal String
        
        [SNIP]
        >       When I get a chance I'll check on my laptop which is running Debian
        >       GNU/Linux with perl 5.8.3. What are you running?
        
        I get the correct results also on my laptop. Did you build this perl
        yourself? Did you run the test suite?
        
        Hmm, maybe it's a unicode problem and it's breaking during the output. I
        don't know much about unicode, so I may be way off. But...
        
        try:
        
        perl -C0 -e ...
        
          -or-
        
        perl -Mbytes -e ...
        
          -or-
        
        maybe better: eliminate the print altogether by doing a round-trip pack
        then unpack and compare the results to see if you get the original value.
        
        Regards,
        Randy.
        

Reply via email to