Results 1 to 16 of 16

Thread: Problems with Unicode(UTF8)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2006
    Posts
    42
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: Problems with Unicode(UTF8)

    This is returned,

    footest=# show client_encoding;
    client_encoding
    -----------------
    SQL_ASCII
    (1 registro)

    footest=# select * from bairros;
    id_bairro | id_cidade | nm_bairro | ch_repositorio
    -----------+-----------+----------------+----------------
    1 | 8105 | ESTREITO | S
    2 | 8327 | PRAIA COMPRIDA | S
    3 | 8105 | CENTRO | S
    4 | 8105 | ATENÇÃO | S
    (4 registros)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Problems with Unicode(UTF8)

    OK and what happens when you execute this?
    footest=# set client_encoding to 'latin1';
    footest=# select * from bairros;

  3. #3
    Join Date
    Sep 2006
    Posts
    42
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: Problems with Unicode(UTF8)

    footest=# set client_encoding to 'latin1';
    SET
    footest=# select * from bairros;
    id_bairro | id_cidade | nm_bairro | ch_repositorio
    -----------+-----------+----------------+----------------
    1 | 8105 | ESTREITO | S
    2 | 8327 | PRAIA COMPRIDA | S
    3 | 8105 | CENTRO | S
    4 | 8105 | ATENÇÃO | S
    (4 registros)

    footest=# show client_encoding;
    client_encoding
    -----------------
    latin1
    (1 registro)

    As 'latin1' the data is shown correctly, more in the continuous application with the incorrect characters.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Problems with Unicode(UTF8)

    Hmm... everything looks OK. Does the database protest if you issue:
    SET client_encoding TO 'UNICODE';
    ?

  5. #5
    Join Date
    Sep 2006
    Posts
    42
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    2

    Default Re: Problems with Unicode(UTF8)

    SET client_encoding TO 'UNICODE';
    SET
    footest=# select * from bairros;
    id_bairro | id_cidade | nm_bairro | ch_repositorio
    -----------+-----------+----------------+----------------
    1 | 8105 | ESTREITO | S
    2 | 8327 | PRAIA COMPRIDA | S
    3 | 8105 | CENTRO | S
    4 | 8105 | ATENO | S
    (4 registros)

    The data come incorrect, already I am losing the hope for this.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Problems with Unicode(UTF8)

    Quote Originally Posted by cristiano View Post
    SET client_encoding TO 'UNICODE';
    SET
    OK, so IMO there shouldn't be any problem with the database.

    What does this program output?
    Qt Code:
    1. #include <QCoreApplication>
    2. #include <QTextCodec>
    3.  
    4. #include <QtDebug>
    5.  
    6. int main( int argc, char ** argv )
    7. {
    8. QCoreApplication app( argc, argv );
    9. qDebug() << QTextCodec::codecForLocale()->name();
    10. }
    To copy to clipboard, switch view to plain text mode 

    Do you use QString::fromUtf8(), QString::toUtf8() and similar methods in your program?
    Do you use any static or global variables that have something to do with the database handling?

    Quote Originally Posted by cristiano View Post
    The data come incorrect
    It doesn't matter, the most important part is that PostgreSQL wants to talk with you in Unicode.

Similar Threads

  1. Problems
    By euthymos in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2006, 19:11
  2. Canvas problems
    By Tommytrojan in forum Qt Programming
    Replies: 22
    Last Post: 9th May 2006, 16:46
  3. QT4 Plugins - problems, problems
    By NormanDunbar in forum Qt Programming
    Replies: 6
    Last Post: 9th May 2006, 15:39
  4. [Win32/VC++ 8.0] Strange problems with qrc_*.cpp files
    By mloskot in forum Installation and Deployment
    Replies: 6
    Last Post: 6th March 2006, 10:28
  5. problems with Opengl
    By SlawQ in forum Qt Programming
    Replies: 4
    Last Post: 12th February 2006, 22:49

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
  •  
Qt is a trademark of The Qt Company.