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. QString from QNetworkReply, how to decode remaining HTML
Forum Updated to NodeBB v4.3 + New Features

QString from QNetworkReply, how to decode remaining HTML

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 507 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    reonZ
    wrote on last edited by reonZ
    #1

    I have a QNetworkReply which contains a HTML page, i can use QString::fromLatin1 (or even QString::fromUtf8 which gives the same result) to get a usable QString and parse it with QRegularExpression, the problem is that some encoded HTML characters are still like ' or & and i don't know how to get the character back from it.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      One possibility would be to use QString::replace to change them back to what you want.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        One possibility would be to use QString::replace to change them back to what you want.

        Hope it helps

        R Offline
        R Offline
        reonZ
        wrote on last edited by
        #3

        @SGaist So i have to know in advance all the possible encoded character and manually decode them ? that seems unproductive

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          AFAIK, these codes are standard so you would have to write one method that goes through the list of them and apply that to your string.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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