I've looked at other answers (php: using DomDocument whenever I try to write UTF-8 it writes the hexadecimal notation of it, DOMDocument->saveHTML() converting to space) and either they don't apply to my situation, or I'm not understanding them.
I'm feeding some HTML into $dom
like this...
$dom = new DOMDocument;
$dom->loadHTML($table_data_for_db);
I then do some stuff with it, then output it like this..
$table_data_for_db = $dom->saveHTML();
echo $table_data_for_db;
The problem is that special characters such as →
end up like this →
.
1.) Is there a way around this?
2.) Is there another way in PHP other than using DOMDocument
, loadHTML
, etc. to strip out sections of HTML? Like, if I want to remove <style id="fraction_class">
and all of its contents, is there another way?
Thank you.