#!/perl/bin/perl -w print "Content-type: text/html\n\n"; use strict; use Encode; my $string = encode("utf-8","أخي الزائر،"); my $encoded = join '',map { '&#' . ord($_) . ';'} split '',$string; print("$encoded\n");