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

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
ioctlvoid

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

Post 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
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

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

Post 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
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
ioctlvoid

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

Post 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?
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

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

Post 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).
Image
ioctlvoid

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

Post 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.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

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

Post 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.
Image
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

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

Post 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...
Locked

Return to “Software & Applications”