PDA

View Full Version : Mysql + QSqlTableModeil: incorrect locale



blackliteon
10th February 2006, 09:39
Hi!
I'm using CP-1251 on my Mysql local server.
So, when fileds contained russian characters, I only see "??????????????????"
What can i do to set locale? Maybe i need firstly say to mysql server "set locale ..." ?

zlatko
10th February 2006, 10:05
Use QTextcodec for convert your data to unicode.

blackliteon
10th February 2006, 10:56
Use QTextcodec for convert your data to unicode.
If I'm using SqlTableModel when we need call this function ?

zlatko
10th February 2006, 11:15
If I'm using SqlTableModel when we need call this function ?
sorry i used qt3 ...but i think next code will be helpful



QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");

// get data from recordset
QString str = m_pCodec->toUnicode(query.value(0).toString());

blackliteon
10th February 2006, 11:40
sorry i used qt3 ...but i think next code will be helpful



QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");

// get data from recordset
QString str = m_pCodec->toUnicode(query.value(0).toString());

Thanks for example!

crocus
10th February 2006, 17:07
http://prog.org.ru/forum/topic_2434.html