Encoding regarding Term::Size
Posted
by sid_com
on Stack Overflow
See other posts from Stack Overflow
or by sid_com
Published on 2010-03-21T13:48:48Z
Indexed on
2010/03/21
13:51 UTC
Read the original article
Hit count: 140
Hello! The Term::Size-module jumbles up the encoding. How can I fix this?
#!/usr/bin/env perl
use warnings; use strict;
use 5.010;
use utf8;
binmode STDOUT, ':encoding(UTF-8)';
use Term::Size;
my $string = 'Hällö';
say $string;
my $columns = ( Term::Size::chars *STDOUT{IO} )[0];
say $columns;
say $string;
Output:
Hällö
140
H?ll?
© Stack Overflow or respective owner