#!/usr/local/bin/perl -w use strict; use Encode; use XML::LibXML; my $parser = XML::LibXML->new({ no_network => 1, encoding => 'utf-8', }); my $str = '

Tomas Laurinavičius

'; print $str, $/; my $copy = $str; my $utf8 = decode('utf-8', $copy, 1); print $utf8, $/; my $doc = $parser->parse_html_string($str, encoding => 'utf-8'); print $doc->documentElement->toString, $/;