Encoding/charset other than UTF-8

UTF-8 is assumed as the default encoding. You can set a different encoding manually — if you really want. This is on how to change the character encodings with fortrabbit.


PHP writes the encoding in the Content-type header. The default charset is UTF-8Content-type: text/html; charset=UTF-8. You can change the charset via ini_set. Here is an example:

ini_set('default_charset', 'iso-8895-15');

Make sure to write this in all your "root" PHP files. Alternatively you can use the header method of PHP to set the charset explicitly:

header('Content-type', 'text/html; charset=iso-8859-1');


Any static file — .txt or .html — is delivered directly via Apache. Per default, Apache assumes the file is utf-8. You can change the charset via an .htaccess directive. Following an example:

AddDefaultCharset iso-8859-1


When you store or fetch data from MySQL, you need to make sure to fit the encoding of the database when you connect to it. Further more, you can set specific encoding to your columns.

To set a different encoding than UTF8 for your database sessions from PHP you can use the mysql_set_charset method. Here is an example:

mysql_set_charset('ISO-8895-15', $connection);

Further reading

Craft CMS

Install guides

Develop & deploy





Tips & tricks

Need individual help?
Learn about Company plans ›
Looking for an old article?
See the full list of articles ›
Found an error?
Contribute on GitHub ›