[Qt-interest] Questions about QUrl::toPercentEncoding() , howto escape all strings ?
Denis Akhmetzyanov
dakhmetzyanov at smartlabs.tv
Mon Mar 22 11:38:34 CET 2010
Hi,
To encode all characters of the string (if this really need), you could use:
QString s = "{a fishy string?}";
QByteArray ba = QUrl::toPercentEncoding(s, QByteArray(), s.toLatin1());
qDebug() << ba;
// prints "%7B%61%20%66%69%73%68%79%20%73%74%72%69%6E%67%3F%7D"
2010/3/22 Aaron Lewis <aaron.lewis1989 at gmail.com>
> Hi,
> I noticed that QUrl::toPercentEncoding() has a overloaded function ,
> there parameters.
> One of them is used to decide the characters that should be escaped
> , so my question is , how do i gather all the strings ?
>
> I think there must be some good ways ;-)
>
> Sample Code:
>
> QByteArray excludeStr(QString("").toLatin1());
> QByteArray includeStr(QString("abcde").toLatin1());
> // I should not work like this , it's bad , i'd like to escape all
> characters , all printable ones
> // Unicode has totally no problems
>
>
>
> ui->escapeLine->setText(QUrl::toPercentEncoding(ui->lineEdit->text(),excludeStr,includeStr));
>
> Any help will appreciate.
>
> --
> Best Regards,
> Aaron Lewis - PGP: 0x4A6D32A0
> FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
> irc: A4r0n on freenode
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100322/d4b65f09/attachment.html
More information about the Qt-interest-old
mailing list