Main  /  Edit version 7  /  Edit version 8  /   /  Users Area

Difference "Encoding and UTF-8" ver. 7 versus ver. 8

Content:

<!--toc-->
Today, UTF-8 is widely considered the standard encoding for the web. Thus, it is important that your application handles encoding problems properly.
## HTTP
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" ]
}
## SQL
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:
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:
cppdb::session sql(database_connection_string);
sql << "SET NAMES \"utf8\"" << cppdb::exec;
string connection_string("mysql:host=127.0.0.1;database=foo;user=bar;password=foobar;set_charset_name=utf8");
cppdb::session session(connection_string);
---
← [Customize your "Page not found | 404" page][prev]
| [Top](#maincontent)
| [Reload the application][next] →
[prev]: /wikipp/en/page/cppcms_1x_tut_404
[next]: /wikipp/en/page/cppcms_1x_reload_application

Sidebar:

## Browse
[CppCMS 1.x.x - Stable][toc]
← [Customize your "Page not found | 404" page][prev]
[Reload the application][next] →
[toc]: /wikipp/en/page/cppcms_1x
[prev]: /wikipp/en/page/cppcms_1x_tut_404
[next]: /wikipp/en/page/cppcms_1x_reload_application

About

CppCMS is a web development framework for performance demanding applications.

Support This Project

SourceForge.net Logo

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

CppCMS needs You


Navigation

Main Page


Valid CSS | Valid XHTML 1.0