Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [ Solved ] From HTML to QString Utf8
Forum Update on Monday, May 27th 2025

[ Solved ] From HTML to QString Utf8

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 8.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bunjee
    wrote on 29 Jul 2011, 22:30 last edited by
    #1

    Greetings Qt enthusiasts,

    I'm trying to convert some HTML text into an Utf8 QString.

    Is there something built in Qt to achieve this ?

    Maybe someone has some code to share for that matter ?

    Thanks.

    B.A.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mlong
      wrote on 29 Jul 2011, 22:41 last edited by
      #2

      "QTextDocument":http://doc.qt.nokia.com/4.7/qtextdocument.html may contain what you need, though I haven't used it, myself, for that purpose.

      Software Engineer
      My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        bunjee
        wrote on 29 Jul 2011, 23:01 last edited by
        #3

        This:
        @QTextDocument document;

        document.setHtml(text);

        document.toPlainText();
        @
        does the trick.

        Thanks !

        1 Reply Last reply
        0

        1/3

        29 Jul 2011, 22:30

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved