×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Sqlite3 utf8 and QString

    Hello,
    i'm experiencing a problem using QString with sqlite3 (utf-8 encoding):

    "SELECT * FROM table WHERE NAME=?"

    sqlite3_bind_text(stmt, 1, qstringValue.??????, -1, 0);

    what function for convert QString value into utf-8 char *??


    Thanks in advance
    Giovanni
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    26

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Re: Sqlite3 utf8 and QString

    Quote Originally Posted by blackbird700 View Post
    It doesn't work for me...
    In my db i've a city: Kāriyāpatti
    with qDebug(city.toUtf8().data()); it shows me: Kāriyāpatti
    infact it doesn't retrive anything from sqlite db (but it is into db!)
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Sqlite3 utf8 and QString

    Maybe the data in the DB isn't UTF8.

    (I wouldn't trust qDebug to reliably represent non-ASCII characters.)

  5. #5
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Re: Sqlite3 utf8 and QString

    Quote Originally Posted by danhicksbyron View Post
    Maybe the data in the DB isn't UTF8.

    (I wouldn't trust qDebug to reliably represent non-ASCII characters.)
    The database is UTF-8 encoded: i say so because through firefox interface i've added that indian city (and if i query firefox interface shows me the city in right reppresentation).

    About qDebug, i thought similar to you, but when i run query through API it doesn't return any record (but there is in).
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

  6. #6
    Registered User
    Join Date
    Mar 2009
    Location
    Italy
    Posts
    153

    Re: Sqlite3 utf8 and QString

    Now I resolved that using QSqlDatabase and co.
    But anyway i experienced the same problem resoved so: QString::fromUtf8( city.toUtf8() ) as a parameter for QSqlQuery's bindValue
    If i use only city.toUtf8() it doesn't store extended character....
    Merry Christmas Tombola! available on OVI Store!
    SuperDaddy available on OVI Store!

    QT VirtualKeyboard: http://qt-apps.org/content/show.php/VirtualKeyboard?content=107388
    Crack Generator: http://qt-apps.org/content/show.php/MosaicCrack?content=121832

Similar Threads

  1. Sqlite3 and Out of Memory error
    By jmclaurin11 in forum [Archived] Qt SDKs and Tools
    Replies: 5
    Last Post: 2010-05-16, 02:48
  2. use sqlite3 in s60 3rd occurs sqlite3 I/O error
    By zhanlan53 in forum Symbian
    Replies: 5
    Last Post: 2010-01-11, 15:59
  3. How to connect SQLite3
    By sanz_nj in forum Symbian
    Replies: 1
    Last Post: 2009-12-11, 12:08
  4. PyS60 sqlite3
    By angelo788 in forum Symbian
    Replies: 2
    Last Post: 2009-09-25, 09:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×