Skip to content
This repository was archived by the owner on Sep 25, 2018. It is now read-only.
This repository was archived by the owner on Sep 25, 2018. It is now read-only.

Double encoding of entities. #6

@ajgarlag

Description

@ajgarlag

When an string with HTML entities like   is loaded, the returned document has these ampersands encoded again to   breaking the original HTML.

$payload = <<< 'HTML'
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>
      Hello&nbsp;world!
    </title>
  </head>
  <body>
    <h1>
      Hello&nbsp;world!
    </h1>
  </body>
</html>
HTML;
$doc = \Layershifter\Gumbo\Parser::load($payload);
var_dump($doc->saveHTML());

Output:

string(162) "<html lang="en"><head><meta charset="utf-8"><title>                                                                                                                                                                                   
      Hello&amp;nbsp;world!                                                                                                                                                                                                                        
    </title></head><body><h1>                                                                                                                                                                                                                      
      Hello&amp;nbsp;world!                                                                                                                                                                                                                        
    </h1></body></html>                                                                                                                                                                                                                            
" 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions