The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


PerlIO::win32console - unicode console output on windows


  binmode STDOUT, ":raw:win32console" if -t STDOUT;
  binmode STDERR, ":raw:win32console" if -t STDERR;

  # input not implemented
  binmode STDIN, ":raw:win32console" if -t STDIN;

  print "unicode characters\n";

  # apply :win32console to STDOUT/STDERR if they're console output
  use PerlIO::win32console "-installout";
  # apply :win32console to STDIN if it's a console
  use PerlIO::win32console "-installin";
  # apply :win32console to any of STDIN, STDOUT, STDERR if they're
  # consoles
  use PerlIO::win32console "-install";


Implements UTF-8 output to the Win32 console, using the wide character console APIs.

You can load the module with -installout to automatically push this layer onto STDOUT/STDERR on Windows:

  use PerlIO::win32console "-installout";

but do nothing on non-Windows.

When this layer is pushed this module attempts to enable ANSI escapes for that console.

The PerlIO layer is only ever available on Windows.

Future possibilities:

  • text input from the console

  • non-text (mouse, resizes) input from the console

  • handling ANSI escapes (Windows has an option do this itself)


Tony Cook <>