Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What package should I install to be able to read files with iso-8859-1 latin1 encoding?

Currently, I only see strange characters instead of text.

% locale

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

The latin1 encoding is "mostly" compatible with UTF-8, since both encodings are supersets of ASCII. This means that you should see normal letters (a-z) but not diacritics (é, è, and so on). Let's try to understand what is the actual encoding of your file.

First, the file command can sometimes detect the encoding. Simply use:

$ file weird_file

You could get weird_file: ISO-8859 text for latin1, weird_file: UTF-8 Unicode text for UTF-8, or something else. Now, if you determined that it is latin1, the best way to display it is actually to open an editor, like gedit, and choose the correct encoding when opening the file. If you want to convert the file to UTF-8, you can then 'Save as' and ask for UTF-8.

If you still don't know the encoding, try to open the document with Libre Office, it's usually good at detection. It's also possible that your file is corrupted (eg. UTF-8 text interpreted as latin1 and saved as UTF-8), or, more likely, that it never contained text. Feel free to upload it so that we can inspect it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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