in reply to Re^2: XML::Parser - Keep Encoding?
in thread XML::Parser - Keep Encoding?

I have no problem.
use strict; use warnings; use HTML::Widget qw( ); my ($up) = @ARGV or die; my $s = chr(0xC9); if ($up) { utf8::upgrade($s); # Internally encoded as UTF-8 } else { utf8::downgrade($s); # Internally encoded as iso-latin-1 } my $w = HTML::Widget->new('widget')->method('GET'); $w->element('Textfield', 's')->label($s)->value($s); my $form = $w->process(); binmode(STDOUT, ':utf8'); print(<<"__EOI__"); <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <p>$s</p> $form __EOI__
>perl 759467.pl 0 > 0.html >perl 759467.pl 1 > 1.html >fc /b 0.html 1.html Comparing files 0.html and 1.HTML FC: no differences encountered

HTML::Widget also worked fine with characters iso-latin-1 can't represent.

Please provide a minimal program to demonstrate your program.

Replies are listed 'Best First'.
Re^4: XML::Parser - Keep Encoding?
by Doron (Initiate) on Apr 27, 2009 at 17:52 UTC

    Sorry for the late reply, I was on vacation.

    When I tried to reproduce my error I found out that it was actually a TT issue, because if I call binmode(STDOUT, ':utf8') it does not have an effect on TT's output (see discussion on their mailing list).

    Thanks for your effort!