Enable Danish charset in CentOS

I am hosting a Danish TYPO3 site and I had the issue that the local charset inside PHP was not correctly being applied.

It turned out that I had to enable the Danish charset from the Linux shell. I enable the Danish charset by running the following command:

localedef -f UTF-8 -i da_DK -c da_DK.UTF-8
export LANG=da_DK.UTF-8

Explanation localedef command

SectionDescription
localedefA utility to compile locale definition files.
-f UTF-8The file that defines the character set that is used by the input file. In our case UTF-8.
-i da_DKThe locale definition file to compile. da_DK is the official code for Danish.
-cWrite the output files even if warnings were generated about the input file. This will force overwriting, so be careful.
da_DK.UTF-8Output file. da_DK.UTF-8 is the official name to use inside PHP to enable the Danish locale.