Page 1 of 1

How to change from UTF-8 to ISO-8859?

Posted: Wed Jan 23, 2013 7:09 pm
by ioctlvoid
How can I change my locale to use ISO-8859-1 instead of the default UTF-8?

OS: Linux Mint 14 (XFCE), 64-bit

Re: How to change from UTF-8 to ISO-8859?

Posted: Thu Jan 24, 2013 3:43 am
by catweazel
ioctlvoid wrote:How can I change my locale to use ISO-8859-1 instead of the default UTF-8?

OS: Linux Mint 14 (XFCE), 64-bit
System Tools > System Settings > Language Support

Re: How to change from UTF-8 to ISO-8859?

Posted: Thu Jan 24, 2013 1:50 pm
by ioctlvoid
TehGhodTrole wrote:
ioctlvoid wrote:How can I change my locale to use ISO-8859-1 instead of the default UTF-8?

OS: Linux Mint 14 (XFCE), 64-bit
System Tools > System Settings > Language Support
This can't possibly be right.

In "Language Support" I'm able to select "langauge for menus and windows", "Install / Remove Languages ...", "Keyboard input method system" and change regional formats. However, there is no way for me to change the character encoding.

How can I change the character encoding?

Re: How to change from UTF-8 to ISO-8859?

Posted: Thu Jan 24, 2013 2:31 pm
by xenopeek
I don't recommend doing this, as UTF-8 supports all characters from ISO-8859-1, but not the other way around. You may end up with garbage characters: http://unix.stackexchange.com/questions ... -terminal/. I'll outline the steps below, but I urge you to also share why you want to do this as there may be a better way without dropping UTF-8, which is recommend to be used on Linux these days.

Edit your /var/lib/locales/supported.d/local file as root:

Code: Select all

gksudo gedit /var/lib/locales/supported.d/local
Add a line for each language you want with ISO-8859-1, for example for en_US you would add:

Code: Select all

en_US.ISO-8859-1 ISO-8859-1
Enable the new encodings:

Code: Select all

sudo dpkg-reconfigure locales
Finally, edit your /etc/default/locale file as root and set your preferences there:

Code: Select all

gksudo gedit /etc/default/locale
For the above example, I would set:

Code: Select all

LANG="en_US.ISO-8859-1"
If you have any LC_ variable defined in your /etc/default/locale, you would update these also. Reboot to activate. To undo the changes you did, just revert your /etc/default/locale to its previous setting (probably LANG="en_US.UTF-8").

Again, I urge you to reconsider this course of action. If you have some text files in ISO-8859-1 format for example, you can use the Linux recode command to convert between character sets (converting the files to UTF-8 format).

Re: How to change from UTF-8 to ISO-8859?

Posted: Fri Jan 25, 2013 7:21 pm
by ioctlvoid
xenopeek wrote:I don't recommend doing this, as UTF-8 supports all characters from ISO-8859-1, but not the other way around. You may end up with garbage characters: http://unix.stackexchange.com/questions ... -terminal/. I'll outline the steps below, but I urge you to also share why you want to do this as there may be a better way without dropping UTF-8, which is recommend to be used on Linux these days.

Edit your /var/lib/locales/supported.d/local file as root:

Code: Select all

gksudo gedit /var/lib/locales/supported.d/local
Add a line for each language you want with ISO-8859-1, for example for en_US you would add:

Code: Select all

en_US.ISO-8859-1 ISO-8859-1
Enable the new encodings:

Code: Select all

sudo dpkg-reconfigure locales
Finally, edit your /etc/default/locale file as root and set your preferences there:

Code: Select all

gksudo gedit /etc/default/locale
For the above example, I would set:

Code: Select all

LANG="en_US.ISO-8859-1"
If you have any LC_ variable defined in your /etc/default/locale, you would update these also. Reboot to activate. To undo the changes you did, just revert your /etc/default/locale to its previous setting (probably LANG="en_US.UTF-8").

Again, I urge you to reconsider this course of action. If you have some text files in ISO-8859-1 format for example, you can use the Linux recode command to convert between character sets (converting the files to UTF-8 format).
Thanks, this actually worked.

I'll tell you why I want ISO-8859. From my past experience there will sooner or later occur some sort of problem related to UTF-8 that will have to be sorted out by switching to ISO-8859. This was a bigger problem before than it is now, but it is still an issue.

E.g. when I SSH to a particular machine running ISO-8859 I get very strange behavior in pine when I'm using that program. I tried to switch to UTF-8 on that remote system, but it didn't help. Now with ISO-8859, everything works perfectly fine.

Re: How to change from UTF-8 to ISO-8859?

Posted: Sat Jan 26, 2013 6:18 am
by xenopeek
In that case, I'd revert /etc/default/locale to its previous configuration (probably LANG="en_US.UTF-8"). When you need to use a program for with UTF-8 is a problem, change the command to start the program to:

Code: Select all

LANG="en_US.ISO-8859-1" command
For example, with ssh, instead of doing:

Code: Select all

ssh username@remotehost.tld
you would do:

Code: Select all

LANG="en_US.ISO-8859-1" ssh username@remotehost.tld
That should work. You have already enable support for en_US.ISO-8859-1, so you can use it for a single program or command as needed by prefixing it like this. This works for graphical applications as well.

Re: How to change from UTF-8 to ISO-8859?

Posted: Sun Jun 23, 2013 5:49 pm
by bjornmu
Yo-hoo! :D Thanks, that worked for me too. I have been struggling two hours to get the mutt mail reader to handle Norwegian characters on my new laptop. It would show them as ? or \345 etc. in existing emails, and when I tried to send a new email with it, it would not recognize it but would insist it was "unknown-8bit". :roll:

Trying to set LANG to UTF-8 was totally useless.

Emacs (which I use for editing email) will still insist on producing UTF-8 so I have to convert that... But that's a problem I've faced before so I had a wrapper script ready. My email setup is a bit complicated already. :lol:

BTW I could not find this thread with the forum search but "linux mint" "iso-8859-1" in google had this as the top hit.

I do wonder why one has to go through this just to *enable* ISO-8859-1. Even with UTF-8 the default, it would not be unreasonable for ISO-8859-1 to also work out of the box. In fact, I installed 'xterm' to run mutt in, and that actually sets LANG to en_US.ISO-8859-1. Which does not work...