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

Questions about applications and software
Forum rules
Before you post please read this

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

Postby ioctlvoid on Wed Jan 23, 2013 7:09 pm

How can I change my locale to use ISO-8859-1 instead of the default UTF-8?

OS: Linux Mint 14 (XFCE), 64-bit
ioctlvoid
Level 1
Level 1
 
Posts: 28
Joined: Tue Jan 08, 2013 9:23 am

Linux Mint is funded by ads and donations.
 

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

Postby catweazel on Thu Jan 24, 2013 3:43 am

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
Mint Testing Team & Mint Donor #3606
KDE 4.12.0, custom preemptive kernel 3.12.5,
Intel i7 4770K @ 4.7GHz, 16GB 2666MHz XMP,
4 Samsung 840 PRO 512GB SSDs in RAID0,
6TB HW RAID10, dual 24" Acer X243H,
Gigabyte nVidia GTX 680 Super Overclock
User avatar
catweazel
Level 7
Level 7
 
Posts: 1656
Joined: Fri Oct 12, 2012 9:44 pm

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

Postby ioctlvoid on Thu Jan 24, 2013 1:50 pm

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?
ioctlvoid
Level 1
Level 1
 
Posts: 28
Joined: Tue Jan 08, 2013 9:23 am

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

Postby xenopeek on Thu Jan 24, 2013 2:31 pm

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).
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14725
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

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

Postby ioctlvoid on Fri Jan 25, 2013 7:21 pm

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.
ioctlvoid
Level 1
Level 1
 
Posts: 28
Joined: Tue Jan 08, 2013 9:23 am

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

Postby xenopeek on Sat Jan 26, 2013 6:18 am

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.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14725
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

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

Postby bjornmu on Sun Jun 23, 2013 5:49 pm

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

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: karlchen and 17 guests