#!/usr/bin/perl -w use strict 1.04; use warnings 1.06; use CGI 3.52; use LWP::UserAgent; use HTTP::Request::Common 'POST'; use JSON 2.53; use Text::Iconv; # dieses Script wird in Notepad++ als "ANSI" gespeichert my $test = POST( 'http://lokalerserver/test_charset2.pl', Content_Type => 'form-data', Content => [ dummy => 'foo', ], ); my $userAgent = LWP::UserAgent->new(); my $response = $userAgent->request($test); my $content = $response->decoded_content; my $ref = JSON->new->utf8->decode($content); my %test = %$ref; my $out = ''; foreach my $k (keys %test) { $out .= $test{$k} } my $converter = Text::Iconv->new('UTF-8','ISO-8859-15'); $out = $converter->convert($out); print STDOUT CGI->new->header(-charset=>'ISO-8859-15').<
$out
HTML_TEIL ;