#!/bin/perl -w use strict; use XML::Twig; my $t= new XML::Twig( keep_encoding => 1); { $/= ''; while( ) { $t->parse( $_); $t->print; print "\n"; } } __DATA__ A document with text in latin1: soupçonné d'être A document with text in latin1:soupçonné d'etre