Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

pack mangles utf output

by roho (Monsignor)
on Aug 28, 2013 at 13:58 UTC ( #1051286=perlquestion: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    my $x = 'FREIGHT  INTRASTATE';
    print $fh $x, "\n";
    print $fh pack('A20',$x), "\n";
    
  2. or download this
    ###################################################################
    # This subroutine pads 'txt' on the right to length 'len'.
    ...
       $len =~ s/^A//i;  # Remove 'A' that system "pack" function uses.
       return sprintf("%s%s",$txt, ' 'x(($len-length($txt))));
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1051286]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (15)
As of 2015-05-27 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (544 votes), past polls