Fixing Locale issues on Debian
This blog post is older than 4 years and may no longer be valid.
1 min read

Fixing Locale issues on Debian


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):

$ locale -a C C.UTF-8 en\_US.utf8 POSIX

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

$ 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.

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

$ 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

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