Hi,
I'm using Unicode Character Set in MFC application.
Database and table created manually using MySQL via command prompt
Code:
CREATE DATABASE hindi_test CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE hindi_test;
CREATE TABLE `hindi` ( `data` varchar(200) COLLATE utf8_unicode_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `hindi` (`data`) VALUES ('कंप्यूटर');
But showing via command prompt like bellow
Code:
mysql> select * from hindi;
+-----------+
| data |
+-----------+
| ???? ?? |
+-----------+
The same table read using vc++ code
Code:
TRY
{
CString QueryStr;
CRecordset recset( &DB);
QueryStr = "SELECT data FROM hindi";
recset.Open(CRecordset::forwardOnly,QueryStr,CRecordset::readOnly);
while( !recset.IsEOF() )
{
recset.GetFieldValue(L"data",sLangname);
::AfxMessageBox( sLangname);
recset.MoveNext();
}
recset.Close();
}
CATCH(CDBException, e)
{
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
Reading output "???? ??".
How can i insert/read hindi language input via both mysql & VC++?
also refereed
MySQL - Supported Character Sets and Collations
Code:
CREATE TABLE `hindi` ( `data` varchar(200) COLLATE ucs2_general_ci NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=ucs2 COLLATE=ucs2_general_ci;
can not read properly.