Fixing Locale issues on Debian

Reading Time: < 1 minute

Business as usual. New feature developed, tested, packed and ready to go. Let me just deploy it to production, smoke test aaaand …. damn! What happened to the currency symbols!?

In my particular case, PHP’s setlocale() returned false – so obviously those darned locales stroke again. SearchEngineOfYourChoice(TM) to the rescue!

Luckily even I was ably to fix this problem quickly without needing to contact the Admins (who wouldn’t have been in the office anyway):

[code lang=”shell”]
$ locale -a
C
C.UTF-8
en_US.utf8
POSIX
[/code]

Aha! It was missing almost all locales. However adding them is quite easy:

[code lang=”shell”]
$ sudo dpkg-reconfigure locales

Generating locales (this might take a while)…
de_DE.ISO-8859-1… done
de_DE.UTF-8… done
de_DE.ISO-8859-15@euro… done
en_US.UTF-8… done
fr_FR.ISO-8859-1… done
fr_FR.UTF-8… done
Generation complete.
[/code]

The dialog that appears after running this command shouldn’t be a problem at all, so I don’t mention it further here. Just select the locales you need there and go for it.

Afterwards check the results by again doing

[code lang=”shell”]
$ locale -a

C
C.UTF-8
de_DE
de_DE@euro
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
deutsch
en_US.utf8
fran├žais
french
fr_FR
fr_FR.iso88591
fr_FR.utf8
german
POSIX
[/code]

That’s already it. Don’t forget to restart your webserver!

Leave a Reply

Your email address will not be published. Required fields are marked *

I accept the Privacy Policy

This site uses Akismet to reduce spam. Learn how your comment data is processed.