Main  /  Edit  /  History  /   /  Users Area

Encoding and UTF-8

Today, UTF-8 is widely considered the standard encoding for the web. Thus, it is important that your application handles encoding problems properly.


It is not enough that the template of your HTML page contains the following declaration:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

The page must be sent over HTTP over a UTF-8 connection, as declared in the HTTP headers. To achieve this, you must add a UTF-8 locale in the configuration file of your cppcms application, e.g.:

"localization" {
    "locales" : [ "en_US.UTF-8" ]


The default encoding of the connection to your SQL server may not be UTF-8. To ensure that the data which is stored as UTF-8 in your database is retrieved appropriately, make sure to configure the connection to use UTF-8. With mysql, add 'set_charset_name=utf8' to your connection string, like this:

string connection_string("mysql:host=;database=foo;user=bar;password=foobar;set_charset_name=utf8");
            cppdb::session session(connection_string);

Customize your "Page not found | 404" page | Top | Reload the application


CppCMS is a web development framework for performance demanding applications.

Support This Project Logo

Поддержать проект

CppCMS needs You


Main Page

Valid CSS | Valid XHTML 1.0