Results 1 to 3 of 3

Thread: SQLite and unicode characters.

  1. #1
    Join Date
    Nov 2009
    Posts
    61
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default SQLite and unicode characters.

    Hi,

    My new Qt application requires to apply a database functionality. I was looking for a simple solution that would not required anything to be installed such as MySql. Therefore, my choice was SQLite. I read its description and I really liked its simplicity but I found a slight problem with text stored in a database. Basically, I cannot make the SQLite work to store unicode character sets. The problem is following. When I try to create database in SQLite (via command line) and then fill it with data, using following command:
    Qt Code:
    1. sqlite3 myname.db < the_file.sql
    To copy to clipboard, switch view to plain text mode 
    the table is not filled with unicode characters but its simple versions, after I query the table. For instance, instead of having words with characters ą,ć,ę,ł,ń,ż, and ź, I get words with characters a,c,e,l,n,z, and z, for instance źdźbło is converted into zdzblo. Why is it happening? Does SQLite have problems with unicode characters? I though it could handle them because it is even possible to run the command
    Qt Code:
    1. PRAGMA encoding = 'UTF-8';
    To copy to clipboard, switch view to plain text mode 

    Has someone any experience with SQLite and provide some information and clues how to overcome this problem. I will be grateful for that.

    ZikO

  2. #2
    Join Date
    Nov 2012
    Posts
    1
    Qt products
    Qt/Embedded
    Platforms
    Android

    Default Re: SQLite and unicode characters.

    Thanks you share info nice .!
    Best flash online friv games .

  3. #3
    Join Date
    Nov 2009
    Posts
    61
    Thanks
    9
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: SQLite and unicode characters.

    I think I found the problem that is cmd.exe. Unfortunately, the default codepage is set to OEM 850 for the command line console. All characters that are pipelined through a console are automatically converted to ANSI. After setting the console to 65001
    Qt Code:
    1. chcp 65001
    To copy to clipboard, switch view to plain text mode 
    everything became working as expected. 65001 is AFAIK UTF-8 codepage. As a side note, I had also a slight problem with files encoded to UTF-8 with BOM. So I would suggest to work with those that does not contains BOM.

Similar Threads

  1. Help needed to convert unicode characters
    By hybrid_snyper in forum Newbie
    Replies: 4
    Last Post: 24th August 2012, 16:20
  2. Replies: 6
    Last Post: 30th March 2012, 09:01
  3. QString to unicode characters
    By jsmax in forum Newbie
    Replies: 1
    Last Post: 19th September 2011, 11:41
  4. Unicode/ASCII characters in QTextStream
    By yren in forum Qt Programming
    Replies: 3
    Last Post: 23rd November 2009, 19:25
  5. Insertion of unicode characters into database oracle through pro c
    By hemananda choudhuri in forum Qt Programming
    Replies: 1
    Last Post: 8th January 2007, 11:42

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.