utf8 in CRecordset (visual c++ MFC)
Posted by: laura lucas
Date: July 19, 2005 12:32PM

Hello, I can store utf8 characters in my database and see them with MySql Query Browser.
I'm trying to retrieve them from a visual c++ application, using MFC CDatabase and CRecordset.
I changed the CDialog font to "Arial Unicode MS" and I can see the right characters in a messagebox, for example, or in edit boxes.

Here is how I connect to the database:

m_db.Open(_T("DB"),FALSE, FALSE,_T("ODBC;DSN=DB;DATABASE=db;User Id=db_user; PASSWORD=secret;CHARSET=utf8") );
m_db.ExecuteSQL(_T( "SET NAMES 'utf8'"));

CTestRecordset rs(&m_db);

rs.Open(AFX_DB_USE_DEFAULT_TYPE, _T("SELECT * from table WHERE table.id = 8"));



low characters show right (ABcd etc) but chinese or arabic characters appear messed up. Can you help me? :-)

Laura Lucas

Options: ReplyQuote

Written By
utf8 in CRecordset (visual c++ MFC)
July 19, 2005 12:32PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.