Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Printing Unicode on the Windows Console and the importance of of i/o layers

by nikosv (Deacon)
on Nov 17, 2010 at 07:23 UTC ( [id://871945]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #unicode_box_incorrect.pl
    use Win32::API;
    ...
    
    print "THIS IS THE INCORRECT EXAMPLE OUTPUT: \n";
    print $unicode_string;
    
  2. or download this
    #unicode_box_correct.pl
    use Win32::API;
    ...
    #use WriteFile API to treat the Console as a file.WriteConsole won't d
    +o it
    $WriteFile=new Win32::API( 'kernel32.dll', 'WriteFile', 'NPNNN', 'N' )
    +;
    $WriteFile->Call($handle,$unicode_string, $lengthx,0,0);
    
  3. or download this
    #unicode_box_correct_pure_perl.pl
    use Win32::API;
    ...
    print "THIS IS THE CORRECT EXAMPLE OUTPUT IN PURE PERL: \n";
    print $unicode_string;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://871945]
Approved by McDarren
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-18 21:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found