docker-lamp
docker-lamp copied to clipboard
Charset Issues
Hi, do you know how can I get charset support for Spanish characters? Thanks!
Hi. Have you tried the directive AddDefaultCharset utf-8?
I tested it on the image mattrayner/lamp:latest-1804 (05750cfa54d5).
$ alias d='sudo docker exec -it container_name' # make it easier
$ d sh -c "echo 'Traducción al inglés.' > /app/spanish.html" # prepare the webpage
First I used utf-8,
$ d sed -i '$a\AddDefaultCharset utf-8' /etc/apache2/apache2.conf # append the directive at the end of the file
$ d service apache2 restart
Traducción al inglés.
And then I switched to iso-8859-1,
$ d sed -i '$s#utf-8#iso-8859-1#' /etc/apache2/apache2.conf # do substitute at the end of the file
$ d service apache2 restart
Traducción al inglés.
Modifying the file apache2.conf is not the only way, please refer to: