in reply to How to sanely handle unicode in perl?
Here's a simpler version of choroba's idea:
Updated: Fixed mistake at line 11. Thanks, choroba!#!/usr/bin/perl -l use strict; use warnings; open my $in, "-|:encoding(UTF-8)", "echo \xc3\xb6" or die $!; my $line = <$in>; chomp($line); open STDOUT, ">-" or die $!; binmode STDOUT, ":encoding(UTF-8)"; print STDOUT "I read a line, that is ", length($line), " chars long.\n +"; print STDOUT "That line in ascii is: $line"; close($in); close(STDOUT); exit 0;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to sanely handle unicode in perl?
by choroba (Cardinal) on Mar 21, 2015 at 18:12 UTC | |
by Khen1950fx (Canon) on Mar 21, 2015 at 21:23 UTC |
In Section
Seekers of Perl Wisdom