#!/usr/bin/perl
use strict;
use warnings;

# slightly modified from http://plasmasturm.org/log/416/

use Encode qw( decode FB_QUIET );

binmode STDIN, ':bytes';
binmode STDOUT, ':encoding(UTF-8)';

while ( <> ) {
	while ( length ) {
		my $out = '';
		$out .= decode( "utf-8", $_, FB_QUIET );
		$out .= decode( "iso-8859-1", substr( $_, 0, 1 ), FB_QUIET ) if length;
		print $out;
	}
}

