Results 1 to 5 of 5

Thread: Encoding/decoding a string to URL and HTML

  1. #1
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Question Encoding/decoding a string to URL and HTML

    Are there any methods in Qt allowing programmer to easily encode/decode a string to URL and HTML?

    Examples of what I need:

    URL encoding:
    "abc def" → "abc%20def"
    URL decoding:
    "abc%20def" → "abc def"

    HTML encoding:
    "A&B&C" → "A&B&C"
    HTML decoding:
    "A&B&C" → "A&B&C"

    Of course these are trivial examples. I need full support for URL and HTML standards.

    It seems HTML can be en/decoded using a QTextEdit::plainText and QTextEdit::html. But this requires QtGui and is not a nice solution at all.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Encoding/decoding a string to URL and HTML

    QUrl reference (it's in core)

  3. #3
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Encoding/decoding a string to URL and HTML

    Thanks. I just have found this.

    And what about the HTML encoding?

  4. #4
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Encoding/decoding a string to URL and HTML

    As far as i know that is in Gui module.

  5. #5
    Join Date
    Nov 2006
    Location
    Poland
    Posts
    35
    Thanks
    2
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Encoding/decoding a string to URL and HTML

    HTML encoding can be done with QTextDocument. Yet it's still QtGui.

Similar Threads

  1. Tools for converting Word to HTML
    By JimCat in forum Newbie
    Replies: 0
    Last Post: 11th March 2010, 17:19
  2. [perl] converting a string
    By mickey in forum General Programming
    Replies: 5
    Last Post: 26th March 2009, 14:33
  3. converting of string to enum
    By jjbabu in forum Qt Programming
    Replies: 2
    Last Post: 24th October 2008, 17:31
  4. Converting number to string.
    By safknw in forum Newbie
    Replies: 2
    Last Post: 18th September 2006, 13:12
  5. converting string to unsigned integer
    By mgurbuz in forum Qt Programming
    Replies: 4
    Last Post: 12th May 2006, 10:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.