I have a tr command that is supposed to transliterate special characters into standard [a-z][A-Z] characters, because I’m tidying up input for something that can’t accept special characters such as ÊÌÐÑÖØÙÜÝßàåæçèîïðõ.
However, it’s not working as expected for my test input.
Command:
Input is Bío-Bío, in the echo command.
echo "Bío-Bío" | tr [ŠŒŽšœžŸ¥µÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýÿ] [SOZsozYYuAAAAAAACEEEEIIIIDNOOOOOOUUUUYsaaaaaaaceeeeiiiionoooooouuuuyy]
Actual Output:
B]]o-B]]o
Desired Output:
Bio-Bio
Can anyone give me any insight into why this is happening?
EDIT0:
I have checked and confirmed both strings in the tr command are the same length (69 characters).
The
trcommand does not understand UTF8.You might have better luck using
iconv: