[Qt-interest] PHP's htmlentities in Qt

Karol Krizka kkrizka at gmail.com
Fri Jul 24 13:02:29 CEST 2009


On Thu, 2009-07-23 at 12:56 -0700, Scott Aron Bloom wrote:
> Take =a look at QUrl::encode and QUrl::decode
Before I posted to this list, I did some googling and that was a
suggestion that came up. However the post I found was quite old, and
searching through Assistant, I do not find any function encode(). There
is however Q3Url::encode().

I did find a function called QUrl::fromPercentEncoding(), which is the
Qt4 equivalent. However, does url encoding take into account HTML
characters like <,>&? I though it would only take care of URL specific
characters, like /,& and @. Looking at Wikipedia entry, this seems about
right:
http://en.wikipedia.org/wiki/Percent-encoding

--
Cheers,
Karol Krizka
http://www.krizka.net

> Scott
> 
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Karol Krizka
> Sent: Thursday, July 23, 2009 9:37 AM
> To: qt-interest
> Subject: [Qt-interest] PHP's htmlentities in Qt
> 
> Hi there,
> 
> I'm wondering if there is a function in Qt that is equivalent to PHP's
> htmlentities [1] and html_entity_decode [2]. One basically turns all
> special HTML characters into entities, and the other one reverses that.
> 
> The reason I am asking this is that I'm trying to save an HTML document
> inside an XML file. The HTML document is some text and images that the
> user will create, and the XML file is a global settings file that will
> contain the said document. I need to encode the HTML special characters
> (<,>,&) into something that will make it possible for me to reread the
> entire document back from the XML file without any trouble.
> 
> --
> Cheers,
> Karol Krizka
> http://www.krizka.net
> 
> [1] http://ch2.php.net/manual/en/function.htmlentities.php
> [2] http://ch2.php.net/manual/en/function.html-entity-decode.php
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list