Connect Microsoft Access database via odbc_connect
in PHP
like this:
$conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=mydatabase.mdb;Client_CSet=UTF-8;Server_CSet=UTF-8", "", "");
Execute the query like this:
odbc_exec($conn, "INSERT INTO mytable (id, name) VALUES ('1', 'Звезда')");
Open database in Microsoft Access. The Russian letters are displayed like shown below:
---------------------
id | name
---------------------
1 | Звезда
PHP-file is in UTF-8 encoding. So the word "Звезда" has UTF-8 representation. Windows system locale for non-unicode programs is Windows-1251.
How to fix encoding when connecting via odbc?