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: 20
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
Image
I had fun once. It was awful.
User avatar
catweazel
Level 6
Level 6
 
Posts: 1220
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: 20
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).
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10457
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: 20
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.
Image
Linux Mint 14 Nadia / 64-bit / Cinnamon
User avatar
xenopeek
Level 20
Level 20
 
Posts: 10457
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands


Return to Software & Applications

Who is online

Users browsing this forum: curt, frsu and 14 guests