Hardly an elegant solution, but my little script will do exactly what you want.
#!/usr/bin/perl -n
#use strict;
#use warnings;
use charnames ();
use encoding "utf8";
$|++;
my $chars = {
'HYPHEN' => '-', # \x{2010}
'SOFT HYPHEN' => '-', # \x{00AD}
'MINUS SIGN' => '-', # \x{2212}
'FIGURE DASH' => '-', # \x{2012}
'ACUTE ACCENT' => "'", # \x{00B4}
'GRAVE ACCENT' => "'", # \x{0060}
'LEFT SINGLE QUOTATION MARK' => "'", # \x{2018}
'RIGHT SINGLE QUOTATION MARK' => "'", # \x{2019}
'LEFT DOUBLE QUOTATION MARK' => '"', # \x{201C}
'RIGHT DOUBLE QUOTATION MARK' => '"', # \x{201D}
'BOX DRAWINGS LIGHT VERTICAL' => '|', # \x{2502}
'MULTIPLICATION SIGN' => '*', # \x{00D7}
'BACKSPACE' => '', # \x{0008}
'DELETE' => '', # \x{0127}
};
# If the first character is an equal sign, skip it and
# display the identity of each remaining character.
#
if (/^=/) {
chomp;
for my $index ( 1 .. length($_) - 1 ) {
my $char = substr( $_, $index++, 1 );
print $char . " "
. ord( $char )
. " "
. sprintf( "\\%03o", ord($char) )
. " "
. sprintf( "\\x{%04X}", ord($char) )
. " = '"
. charnames::viacode( ord($char) )
. "'\n" ;
}
} else {
for my $cname ( keys %$chars ) {
my $char = chr( charnames::vianame($cname) );
s/$char/$chars->{$cname}/g;
}
print;
}
Run this and it sits there waiting for you to paste something to your terminal. Once it receives some input, it starts replacing characters by their unicode name with the values from the $chars hashref.
If you need to identify any unicode characters because you want to add to the hashref of replacement characters, press the = key first and then paste to your terminal.