Difference "Encoding and UTF-8" ver. 4 versus ver. 5
Titles:
Version 4 | Version 5 |
---|
Encoding and UTF8 | Encoding and UTF-8 |
Content:
<!--toc--> |
|
Today, UTF8 is widely considered as the standard encoding for the web. Thus, it is important that your application handles encoding problems properly. |
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: |
|
|
cppdb::session sql(database_connection_string); |
sql << "SET NAMES \"utf8\"" << cppdb::exec; |
|
|
|
|
About
CppCMS is a web development framework for performance demanding applications.
Support This Project
Navigation
Main Page
Valid CSS
| Valid XHTML 1.0