My goal is to read and write utf8 strings to a mysql database with Delphi2006 and php as well.
Database: Ver 14.12 Distrib 5.0.27, for Win32 (ia32)
Code: Select all
DROP DATABASE IF EXISTS Testing;
CREATE DATABASE Testing;
USE Testing;
CREATE TABLE Testing (
TestingId INTEGER NOT NULL AUTO_INCREMENT,
TestingValue VARCHAR(255),
PRIMARY KEY ( TestingId )
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;Code: Select all
mysql_pconnect( 'localhost', 'test', 'test' );
mysql_select_db( 'Testing' );
if ( $_REQUEST[ "TestingValue" ] )
{
mysql_query( "INSERT INTO Testing ( TestingValue ) VALUES ( '" . $_REQUEST[ "TestingValue" ] . "' )" );
}
?>
Code: Select all
mysql> select * from Testing;
+-----------+--------------+
| TestingId | TestingValue |
+-----------+--------------+
| 1 | Mot├╢rhead |
+-----------+--------------+
1 row in set (0.00 sec)version: MyDac 4.40.0.22
I also added a TMyTable, a TDataSource and a TntDBEdit onto the form linked everything together and..... the TntDBEdit contained the multibyte string from database: "Motörhead"
I also tried to play around with MyConnection.Options.Charset := utf8 but with no success.
What did I do wrong?
Thanks,
Herwig