What is the correct way to set locale on server?

On my development machine (a vagrant box with ubuntu) with a php application runnning I have one language with swedish: sv_SE.utf8

And I'm setting the locale with this function -

setlocale(LC_ALL, 'sv_SE');

And this works, but in production server it didn't. Consider those language settings in production:

sv_SE
sv_SE.iso88591
sv_SE.iso885915
sv_SE.utf8
swedish

When I changed it to

 setlocale(LC_ALL, 'sv_SE.utf8');

..it works. Somehow, the old code retrieves the wrong language, but when I changed it works. But is it correct way to configure the server with all the languages encodings? Wouldn't it be sufficient to just have sv_SE.utf8 - language? Why would you want any else setting? Like sv_SE.iso88591. Seems weird to me.

4 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like