I'm trying to convert a Right Single Quotation Mark to an Apostrophe using tr
.
tr "`echo -e '\xE2\x80\x99'`" "`echo -e '\x27'`" < a > b
given a UTF-8 encoded file called a
which contains this example:
We’re not a different species
“All alone?” Jeth mentioned.
OS X uses the BSD tr
and produces a nice result:
We're not a different species
“All alone?” Jeth mentioned.
Ubuntu uses the GNU tr
and produces this nasty result:
We'''re not a different species
''<9C>All alone?''<9D> Jeth mentioned.
How can I accomplish this conversion in Ubuntu?
echo It’s easy | perl -CS -Mutf8 -pe "tr/’/'/"