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
Servers for Qt installer are currently down

Avoid automatic entity encoding

Scheduled Pinned Locked Moved Qt WebKit
3 Posts 2 Posters 1.3k 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
    raven-worx
    Moderators
    wrote on 11 Apr 2013, 07:32 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 11 Apr 2013, 12:31 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
      • R Offline
        R Offline
        raven-worx
        Moderators
        wrote on 11 Apr 2013, 13:00 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

        1/3

        11 Apr 2013, 07:32

        • 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