PDA

View Full Version : Qt character encoding error



premroxx
14th September 2011, 21:30
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)

ChrisW67
14th September 2011, 22:39
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.

premroxx
15th September 2011, 03:21
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

ChrisW67
15th September 2011, 23:07
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.

premroxx
18th September 2011, 03:26
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.


void MainWindow::on_rfid(){
this->ui->lineEdit->show();
this->ui->lineEdit->setFocus();
}
void MainWindow::on_lineEdit_textChanged(const QString &arg1)
{
txt_browser = arg1;
}

ChrisW67
20th September 2011, 20:15
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?