[KEY] һ ح د ؼ ^ KeyStr=һحدؼ^ KeyMap=һحدؼ^ [DICT] #### my %conv = ( 'U\+003d' => 'key1', ); #### while () { push ( @raw, utf16($_)); } #### my @hexout; foreach $line ( @raw ) { # get the hex values for uthe input line my $hvs = $line->hex; # now loop over the conversions foreach my $hexkey ( keys %keyconv ) { # if this char to be replaced is in # this line, do a conversion if ( $hvs =~ /$hexkey/ ) { # replacement chars are utf8... my $newStr8 = utf8($keyconv{$hexkey}); # ...so convert it to utf16 my $newStr16 = $newStr8->utf16; my $Str16Obj = utf16($newStr16); # and get its hex value in utf16 format my $newhex = $Str16Obj->hex; print "Replaced $hexkey with", "$newStr (hex: $newhex) in line\n", "(hex: $hvs)\n" if $debug; # do the conversion $hvs =~ s/$hexkey/$newhex/g; } } # maintain a list of output hex values. push @hexout, $hvs; } #### Unicode::String->stringify_as( 'utf16' ); my $out16 = Unicode::String->new(); $out16->hex ( join '', @hexout); print OUTFILE $out16; close F || die; #### print OUTFILE chr hex foreach ( split /\s*/, $outhex );