Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated utf8_decode with mb_convert_encoding #26

Merged
merged 3 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function add_anchor_attribute( string $html ): string {

libxml_use_internal_errors( true );
$dom = new \DOMDocument();
$dom->loadHTML( $html_wo_nbs, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
$dom->loadHTML( '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . $html_wo_nbs, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );

// use xpath to select the Heading html tags.
$xpath = new \DOMXPath( $dom );
Expand All @@ -432,7 +432,7 @@ function add_anchor_attribute( string $html ): string {
}

// Save the HTML changes.
$content = utf8_decode( $dom->saveHTML( $dom->documentElement ) ); //phpcs:ignore
$content = $dom->saveHTML( $dom->documentElement ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase

return $content;
}
Expand Down
Loading