#!/usr/bin/perl no utf8; local $SIG{__WARN__}=sub{die "$_[0]Are you sure this is Unicoded file?\n" }; while(<>){ s/([\x80-\xff])/pack("U",ord($1))/ge; s/\\unicode\{(\d+)\}/pack("U",$1)/ge; s/\\x\{(\d+)\}/pack("U",$1)/ge; print; }