Converting files between UTF-8 and ISO-8859 on Linux

Every time I come across Unicode, nothing seems to work. I am on Linux and I got these files from Windows:

$file *
file1: UTF-8 Unicode text
file2: ISO-8859 text
file3: ISO-8859 text

      

Nothing worked until I found out that the files have different encodings. I want to make my life easy and have them all in one format:

iconv -f UTF-8 -t ISO-8859 file1 > test
iconv: conversion to `ISO-8859' is not supported
Try `iconv --help' or `iconv --usage' for more information.

      

I tried converting to ISO because only 1 conversion +, when I open these ISO files in gedit, the German letter "ΓΌ" is displayed just fine. Ok, try this:

iconv -f ISO-8859 -t UTF-8 file2 > test
iconv: conversion from `ISO-8859' is not supported
Try `iconv --help' or `iconv --usage' for more information.

      

but obviously it didn't work.

+3


source to share


1 answer


ISO-8859-x (Latin-1) encoding only contains very limited characters, you should always try to encode UTF-8 to make life easier.

And utf-8 (Unicode) is a superset of the ISO 8859 standard, so it's no surprise that you couldn't convert UTF-8 to ISO 8859

It seems the command file

just gives very limited information about the file encoding



You can try to guess the encoding ISO-8859-1 or ISO-8859-15 or another 2 to 14 as mentioned in the comment from @hobbs

And you can get the supported encoding iconv

aticonv -l

If you think you are having a hard time guessing the real encoding of the files, this silly script might help you: D

+3


source







All Articles