Tutorial by Examples

1st or 2nd line in source code (to have literals in the code utf8-encoded): # -*- coding: utf-8 -*- Connection: db = MySQLdb.connect(host=DB_HOST, user=DB_USER, passwd=DB_PASS, db=DB_NAME, charset="utf8mb4", use_unicode=True) For web pages, one of these: <meta charset=...

PHP

In php.ini (this is the default after PHP 5.6): default_charset UTF-8 When building a web page: header('Content-type: text/plain; charset=UTF-8'); When connecting to MySQL: (for mysql:) Do not use the mysql_* API! (for mysqli:) $mysqli_obj->set_charset('utf8mb4'); (for PDO:) $db...

Page 1 of 1