Additional
dbCAP
AnyDAC
ThinDAC
NCOCI8
Topic: Help me examples with read/write Unicode + mySQL ?
Help me examples with read/write Unicode + mySQL ?
Posted: 2007/06/27 00:35
 
I want to use Unicode with mysql but when i fetch data on TntDBGrid, it show '?' characters. I used TDataSoure and I think it can not support WideString.

Please help me examples that desmonstrate read/write a Unicode string.

Thanks so much !
Re:Help me examples with read/write Unicode + mySQL ?
Posted: 2007/06/27 00:41
 
Hello

You should set in connection definition parameters:

CharacterSet=utf8
Utf8Mapping=WideString

Regards,
Dmitry
Re:Help me examples with read/write Unicode + mySQ
Posted: 2007/06/27 03:09
 
Thanks for supporting.

I entered data in db using phpMyadmin, and this is data :

hoàng tuấn anh
nguyễn thị phương dung


Before i set param, when I fetch it on TntDBGrid, it showed :

hoàng tu?n anh
nguy?n th? ph??ng dung


After set

CharacterSet=utf8

Utf8Mapping=WideString


it showed :

hoà ng tuấn anh
nguyễn thị phương dung


If I entered data directly using TntDBGrid on application, string has changeed to '?' after I execute POST command :

nguy?n th? h?ng loan



Please help me again or send me a demo project! Thanks alot !
Re:Help me examples with read/write Unicode + mySQ
Posted: 2007/06/27 03:59
 
Hello

Please, send me the dump of your table with unicode data inside. I will check it.

Regards,
Dmitry
Re:Help me examples with read/write Unicode + mySQ
Posted: 2007/06/27 10:17
 
This is sql of my test db :

-- phpMyAdmin SQL Dump
-- version 2.8.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 28, 2007 at 12:14 AM
-- Server version: 4.1.22
-- PHP Version: 5.1.4
--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Table structure for table `user`
--

CREATE TABLE `user` (
`id` int(5) unsigned NOT NULL auto_increment,
`name` varchar(200) character set utf8 collate utf8_unicode_ci NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;

--
-- Dumping data for table `user`
--

INSERT INTO `user` (`id`, `name`) VALUES (1, 'hoàng tuấn anh'),
(2, 'nguyễn thị phương dung'),
(3, 'nguy?n th? h?ng loan');
Re:Help me examples with read/write Unicode + mySQ
Posted: 2007/06/28 05:33
 
1) Because I see "?" marks in data, I think, I cannot use this your dump. Please, use MYSQLDUMP.EXE.
2) Consider to switch to MySQL v 5.0. Because it supports Unicode data much better.

Regards,
Dmitry

Post edited by: Diman, at: 2007/06/28 05:35
Re:Help me examples with read/write Unicode + mySQ
Posted: 2007/06/29 00:24
 
Thanks for your great idea !! After I update mysql v5.1, data has showed correctly !

Thanks again !