in reply to Re: binmode, encoding layer, ignoring encoding problems
in thread binmode, encoding layer, ignoring encoding problems
Hi ikegami,
your information was a hint in the right direction. Thank you for that.
But now I face a different error. I made a litte program to show the problem:
#!/usr/bin/perl use strict; use warnings; use PerlIO::encoding; use Encode; use Data::Dumper; my $a = "\xe2\x82\xac"; #Euro Sign in UTF-8 my $euro_in_unicode = decode("UTF-8", $a); print Dumper(\$euro_in_unicode), "\n"; open my $fh, ">", "output.txt" or die $!; { local $PerlIO::encoding::fallback = Encode::FB_DEFAULT; binmode $fh, ":encoding(latin1)"; } print $fh $euro_in_unicode, "\n"; close $fh;
The output of Dumper shows the right codepoint $VAR1 = \"\x{20ac}";. The file output.txt does have a ? sign in it as the Euro-Sign can't be displayed in REAL latin-1, but I get the additional output
on the console. Line 18 is the close statement.Close with partial character at am85.pl line 18. Close with partial character.
Can someone explain that? What do I have to do to get rid of that? What is wrong?
Best regards
Andreas
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: binmode, encoding layer, ignoring encoding problems
by ikegami (Patriarch) on May 21, 2010 at 05:21 UTC |