Results 1 to 6 of 6

Thread: Mysql + QSqlTableModeil: incorrect locale

  1. #1
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation Mysql + QSqlTableModeil: incorrect locale

    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 ..." ?
    Succes is 5% of talent and 95% of work!

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Mysql + QSqlTableModeil: incorrect locale

    Use QTextcodec for convert your data to unicode.
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mysql + QSqlTableModeil: incorrect locale

    Quote Originally Posted by zlatko
    Use QTextcodec for convert your data to unicode.
    If I'm using SqlTableModel when we need call this function ?
    Succes is 5% of talent and 95% of work!

  4. #4
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Mysql + QSqlTableModeil: incorrect locale

    Quote Originally Posted by blackliteon
    If I'm using SqlTableModel when we need call this function ?
    sorry i used qt3 ...but i think next code will be helpful

    Qt Code:
    1. QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");
    2.  
    3. // get data from recordset
    4. QString str = m_pCodec->toUnicode(query.value(0).toString());
    To copy to clipboard, switch view to plain text mode 
    a life without programming is like an empty bottle

  5. #5
    Join Date
    Jan 2006
    Location
    Saint-Petersburg (Russia)
    Posts
    41
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mysql + QSqlTableModeil: incorrect locale

    Quote Originally Posted by zlatko
    sorry i used qt3 ...but i think next code will be helpful

    Qt Code:
    1. QTextCodec *m_pCodec = QTextCodec::codecForName("CP1251");
    2.  
    3. // get data from recordset
    4. QString str = m_pCodec->toUnicode(query.value(0).toString());
    To copy to clipboard, switch view to plain text mode 
    Thanks for example!
    Succes is 5% of talent and 95% of work!

  6. #6
    Join Date
    Feb 2006
    Posts
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Mysql + QSqlTableModeil: incorrect locale


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.