#!/usr/bin/perl use encoding 'utf8' ; #binmode(STDIN,":encoding(utf8)"); binmode(STDOUT,":encoding(iso8859-1)"); local $SIG{__WARN__}=sub{die "$_[0]Are you sure this is Unicoded file?\n" }; while(<>){ s/([\x{100}-\x{ffff}])/ "\\unicode{".ord($1)."}"/ge; s/([\x{80}-\x{ff}])/chr(ord($1))/ge; print; }