[Qt-interest] [SOLVED] Re: Questions about QUrl::toPercentEncoding() , howto escape all strings ?
Aaron Lewis
aaron.lewis1989 at gmail.com
Mon Mar 22 13:47:35 CET 2010
Denis Akhmetzyanov wrote:
> 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"
Yeah , so cool . I should use the strings that to be escaped as `include
string'.
Thanks Denis ;-)
>
> 2010/3/22 Aaron Lewis <aaron.lewis1989 at gmail.com
> <mailto: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 <mailto:Qt-interest at trolltech.com>
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
--
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
More information about the Qt-interest-old
mailing list