0

I am trying to find a command in Unix to translate English characters to Russian. So I first listed the Russian locales available in my box:

#locale -a | grep -i RU
ru_RU
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
russian

Now I am trying a command to convert English chars to Russian characters or rather translate equivalently:

#iconv -f en_US.utf8 "Hi" -t ru_RU.utf8
iconv: conversions from `en_US.utf8' and to `ru_RU.utf8' are not supported

I tried various google pages and other command but not able to find exact command for my purpose?

Please suggest which command would produce the expected result.

  • 1
    You are not showing what the expected result should be or what you're trying to convert. Do you realize that your command, if it were supported, wouldn't change anything in the data? – Julie Pelletier Aug 27 '16 at 3:45
  • Please do not use multiple accounts. Come back with the original account to do your modifications. – Julie Pelletier Aug 27 '16 at 3:57
  • 2
    iconv is a character encoding converter, not a language translator. – Julie Pelletier Aug 27 '16 at 3:57
  • 2
    echo "Hi" | iconv -f utf-8 -t koi8-ru is still "Hi", all russian character sets support latin letters – grochmal Aug 27 '16 at 4:06
  • Plainly said, you're asking the wrong question. You should post another question to get help finding a translation program. – Julie Pelletier Aug 27 '16 at 16:17
2

The message

iconv: conversions from `en_US.utf8' and to `ru_RU.utf8' are not supported

could be improved, e.g.,

iconv: conversions from `en_US.utf8' and to `ru_RU.utf8' is pointless

or

iconv: conversions from `en_US.utf8' and to `ru_RU.utf8' will not modify your data

iconv translates character encoding. While it may recognize the name of a locale, there is a difference between encoding and locale:

  • encoding lists all of the available character codes in a character set, with reference to the appearance of the characters (referred to as glyphs).
  • locale tells how the characters in a given encoding are used, e.g., which are printable, which are not, which are used for special cases such as decimal separators. It also deals with things that are not related to character sets, such as the names for the days of the week.

Since both locales en_US.utf8 and ru_RS.utf8 use the same encoding, iconv has nothing to do. Since it cannot guess what you might be trying to do, it tells you that the conversion is "not supported".

What iconv does support is conversions between different encodings. For instance, in your list

ru_RU.iso88595
ru_RU.koi8r

do not use UTF-8 encoding. Those are used for character sets with fewer than 256 characters; UTF-8 is used for Unicode, with many more than 256 characters.

As for what is the correct command to use, that depends on what the actual encoding of your input file is (it might be UTF-8, it might be ISO-8859-1), and whether you want the output to be UTF-8 (no problem) or one of the other encodings (less likely, and involving some loss of information).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.