Charset Handling
Input/Output Charset
b2evolution 1.8 and above will attempt to convert all data it outputs to the $io_charset
. Versions 0.x did not do any conversion.
Charset conversion requires that the PHP mb_strings extension is available.
Note: by "data" we mean everything that comes from the database. The skin templates for example will remain untouched, so make sure your skins are written in a charset compatible with your $io_charset. Default skins are written in plain 7 bits ASCII, so they are compatible with just about anything.
b2evolution 1.8 and above will also expect any incomming data to be encoded in the $io_charset
.
The $io_charset
is typically defined automatically by the ‘'’current locale”’.
- The current locale is defined by the locale of the blog you are currently viewing.
- However, if you are not viewing a blog page (but a backoffice page for example), the current locale is defined by your user profile.
- Finally, if you are not even logged in, the current locale is the ‘'’default locale from database”’ (Regional settings),
$default_locale
defined in/conf/_locales.php
or the one ‘'’detected from the browser”’ (in this order).
Experimenting in b2evolution version 1.9 beta, you can force the $io_charset
to a specific charset by setting $force_io_charset_if_accepted
in /conf/_locales.php
. This can be used to force all outputs to UTF-8 for example.
Internal Charset
By default, the internal charset $evo_charset
is left empty in /conf/_locales.php
which means it will follow the $io_charset
.
In most cases this will work fine.
Database Charset
MySQL also has its own charset for storing content in the database.
- If your
$io_charset
will always be the same (if you blog only in one language it most likely will), it is most efficient to use that same charset for your MySQL database (see MySQL documentation – you can check MySQL charsets with PhpMyAdmin).
- If you use multiple languages and charset for your blogs, you should try to use a MySQL charset which is compatible with all your I/Os. UTF-8 comes in handy here. Note that using UTF-8 requires MySQL 4.1 .
Conversion from the MySQL charset to the b2evo internal charset ($evo_charset
) will be done directly by the MySQL client library ( "the MySQL connection") through the use of a "SET NAMES" command.
If you need to upgrade the encondig of your database to UTF-8, please read this: Upgrading your database to UTF-8.