Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Avoid automatic entity encoding

Avoid automatic entity encoding

Scheduled Pinned Locked Moved Qt WebKit
3 Posts 2 Posters 1.3k 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.
  • raven-worxR Offline
    raven-worxR Offline
    raven-worx
    Moderators
    wrote on last edited by
    #1

    Hi,
    i couldn't find any possibility or workaround to get the HTML source from a QWebView with preserved entities.
    So i hope someone can point me to something i've overseen ;)

    The problem is, when i set the HTML (containing entities) manually to the QWebView and try to retrieve later i get a QString with the entities encoded to their raw corresponding unicode characters.

    best regards.

    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
    If you have a question please use the forum so others can benefit from the solution in the future

    1 Reply Last reply
    0
    • P Offline
      P Offline
      prady_80
      wrote on last edited by
      #2

      I have not tried this,
      Could you please check if this works?
      @
      QTextDocument text;
      text.setHtml(<The obtained HTML here>);
      QString plain = text.toPlainText();
      @

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        no this doesn't work either. Which would have surprised me ... since a QTextDocument doesn't even support the full HTML subset?

        I'm working on a WYSIWYG editor and thus it's mandatory to preserve the entities which the user added to the document.

        A easy work around would be to iterate over the whole source string and replace every contained QChar with QChar::unicode() > 255 to &#UNICODE and/or hold a list of the most common used entities.

        I think that's the way i will have to go.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        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