Skip to content

Commit 96f4630

Browse files
committed
PHP Encoding Issue Check
1 parent 868c337 commit 96f4630

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

app/code/Magento/Sales/Helper/Admin.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function escapeHtmlWithLinks($data, $allowedTags = null)
166166

167167
$internalErrors = libxml_use_internal_errors(true);
168168

169-
$data = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
169+
// $data = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
170170
$domDocument->loadHTML(
171171
'<html><body id="' . $wrapperElementId . '">' . $data . '</body></html>'
172172
);
@@ -192,7 +192,9 @@ public function escapeHtmlWithLinks($data, $allowedTags = null)
192192
}
193193
}
194194

195-
$result = mb_convert_encoding($domDocument->saveHTML(), 'UTF-8', 'HTML-ENTITIES');
195+
// $result = mb_convert_encoding($domDocument->saveHTML(), 'UTF-8', 'HTML-ENTITIES');
196+
$result = html_entity_decode($domDocument->saveHTML(), ENT_QUOTES, 'UTF-8');
197+
196198
preg_match('/<body id="' . $wrapperElementId . '">(.+)<\/body><\/html>$/si', $result, $matches);
197199
$data = !empty($matches) ? $matches[1] : '';
198200
}

lib/internal/Magento/Framework/Escaper.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function ($errorNumber, $errorString) {
9797
}
9898
);
9999
$data = $this->prepareUnescapedCharacters($data);
100-
$string = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
100+
$string = $data; //mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
101101
try {
102102
$domDocument->loadHTML(
103103
'<html><body id="' . $wrapperElementId . '">' . $string . '</body></html>'
@@ -114,7 +114,9 @@ function ($errorNumber, $errorString) {
114114
$this->escapeText($domDocument);
115115
$this->escapeAttributeValues($domDocument);
116116

117-
$result = mb_convert_encoding($domDocument->saveHTML(), 'UTF-8', 'HTML-ENTITIES');
117+
// $result = mb_convert_encoding($domDocument->saveHTML(), 'UTF-8', 'HTML-ENTITIES');
118+
$result = html_entity_decode($domDocument->saveHTML(), ENT_QUOTES, 'UTF-8');
119+
118120
preg_match('/<body id="' . $wrapperElementId . '">(.+)<\/body><\/html>$/si', $result, $matches);
119121
return !empty($matches) ? $matches[1] : '';
120122
} else {

0 commit comments

Comments
 (0)