View Full Version : how to detect Ñ or alt+165 from Qstring?
triperzonak
7th July 2008, 10:35
hi,
im having a bit of trouble in detecting Ñ or alt+165 in a string..
im using str.indexOf("Ñ") but it detects different char..
how to this properly please help..
tnx
Auryn
7th July 2008, 12:12
I am using Qt4.4 in Kubuntu 8.04 with UTF-8 encoding as default.
This applicacion writen in a UTF-8 text file works for me.
Try it, I hope it can helps you.
#include <QString>
#include <TextStream>
int main()
{
QTextStream salida(stdout);
QString cadena;
cadena = "aquÃ* Ñ está";
salida<<cadena.indexOf("Ñ")<<endl;
}
triperzonak
7th July 2008, 15:04
I am using Qt4.4 in Kubuntu 8.04 with UTF-8 encoding as default.
This applicacion writen in a UTF-8 text file works for me.
the code you wrote is what exactly what im doing.. but its changing the Ñ to some other characters.. how to change the encoding? so that it will not convert the Ñ to other chars?
triperzonak
8th July 2008, 02:04
atlast.. my problem solve by using
str.indexOf(QString::fromUtf8("Ñ"))
atleast i got the idea of utf-8 tnx
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.