Php default charsets

Un problema muchas veces repetido cuando no trabajas en ingles y ASCII. No siempre se controla la codificacion que se usa en distintos entornos de trabajo y produccion; al final acaban apareciendo caracteres extraños y problemas de codificacion.

Working with many development and production some people forgets to check their default charsets; in the end encoding mismatchs crawl. I’ve seen a few programmers falling in this trap.

Last time our php was Latin-1 encoded and the production Apache server used Utf-8 by default. In a shared hosting environments the default encoding can be set from the .htaccess file:

AddCharset ISO-8859-1 .php
AddDefaultCharset ISO-8859-1

Same thing from php:

PHP. Use the header() function before generating any content, e.g.:
header(’Content-type: text/html; charset=utf-8′);

Links and discussion:

This entry was posted in Blog, Deployment and tagged , , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared.

Subscribe without commenting