www.platon.net
Depending on the encoding your web page uses, you should set the encoding of the data coming out of the MySQL database.
If the data coming out of the database is in the same encoding as your page, no anomalies will appear in characters with accents and other special symbols.
This is the usual way to connect to the MySQL database from your PHP script:
<?php
mysql_connect('localhost','login','password');
mysql_select_db('database');
?>
Immediately after connecting, you need to set the encoding in which you want to read data from the database and write data into it. The encoding the database itself runs in, typically UTF-8, does not matter.
Here are the three most used character encodings in central Europe:
For each of these encodings we give you the commands to run right after the commands that connect to the database.
UTF-8
<?php
mysql_query('SET NAMES UTF8');
mysql_query('SET COLLATION_CONNECTION=UTF8_GENERAL_CI');
?>
ISO-8859-2
<?php
mysql_query('SET NAMES LATIN2');
mysql_query('SET COLLATION_CONNECTION=LATIN2_GENERAL_CI');
?>
WINDOWS-1250
<?php
mysql_query('SET NAMES CP1250');</
mysql_query('SET COLLATION_CONNECTION=CP1250_GENERAL_CI');
?>
We accept problem reports and any other feedback related to the use of our products and services.
helpdesk@platon.net +421 222 111 321
In case you need any help, contact us by e-mail or by phone.
Give our online help center a try. You will find more than:
Questions about our products or any specific request? Contact us.