Results 1 to 6 of 6

Thread: Qt character encoding error

  1. #1
    Join Date
    Aug 2011
    Posts
    42
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    10

    Default Qt character encoding error

    Qt is displaying characters in an unusual coding
    Instead of getting 00000000097A66BE
    On Qt i get ˆˆˆˆˆˆˆˆˆÉ +ÿ¨¨š+
    Ofcourse, the fist one is right. Is this because of an encoding/pasring error? how can i solve this? The characters are read from an external device which is working properly(I tested it in worried etc)

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Qt character encoding error

    So given some input you don't specify, collected in some manner you don't specify, you expect some function you don't specify to give you "00000000097A66BE" rather than something else. Care to elaborate? My crystal ball is out for polishing this morning.

  3. #3
    Join Date
    Aug 2011
    Posts
    42
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    10

    Default Re: Qt character encoding error

    I'm really sorry for being ambiguous. I have an rfid reader. When tagged it transfer an hexadecimal number to the keyboard buffer. So as along as there is an active cursor. it will just type the tag just like you type it on a keyboard. I store this information. It works fine on my laptop. The problem i'm having is while running this program on a different pc. i have installed all the drivers correctly. The reader works flawlessly on this system(I have checked it multiple times). But when i run it on QT it spits out the characters all wrong. My guess is that there might be something wrong with the encoding Does this clarify the question? I'm stuck here

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Qt character encoding error

    If the RFID reader driver just stuffs the characters '0', '0', 'A', 'B', '9' etc. into the system keyboard buffer then Qt has nothing to do with it beyond reacting as if you were typing it yourself. How are you reading the data from the keyboard/what widget has focus when you scan? What are you doing to it before displaying it? Show the code.

  5. #5
    Join Date
    Aug 2011
    Posts
    42
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    10

    Default Re: Qt character encoding error

    I use a linedit set focus o it so that its active. Now whatever is typed on keyboard or any such event is recorded. It works fine on my PC but it just spits out garbage when i try on a different PC. Also the reason why suspect QT is because, when i open a notepad and click on it to make the cursor active & then use the rfid reader, it types the data perfectly.
    Qt Code:
    1. void MainWindow::on_rfid(){
    2. this->ui->lineEdit->show();
    3. this->ui->lineEdit->setFocus();
    4. }
    5. void MainWindow::on_lineEdit_textChanged(const QString &arg1)
    6. {
    7. txt_browser = arg1;
    8. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Lykurg; 18th September 2011 at 11:40. Reason: missing [code] tags

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Qt character encoding error

    What happens with a QTextEdit or the Save As file name line edit as the target? (You can use the Application Example under MainWindows in qtdemo)

    Can you point to the documentation for the device?

Similar Threads

  1. Qt for Android: Character Encoding problems.
    By HeReSY in forum Qt Programming
    Replies: 2
    Last Post: 18th March 2012, 22:48
  2. problem in character encoding
    By fulbay in forum Qt Programming
    Replies: 4
    Last Post: 17th August 2011, 14:29
  3. QWebView and QByteArray: encoding error
    By missoni in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 16th May 2011, 23:41
  4. Character encoding in text edit and llne edit
    By greenvirag in forum Qt Programming
    Replies: 3
    Last Post: 20th January 2009, 09:45
  5. Character encoding issues
    By yagabey in forum Qt Programming
    Replies: 11
    Last Post: 15th December 2008, 23:20

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.