Force UTF-8 encoding in htmlspecialchars
This commit is contained in:
parent
69b0fb9eaf
commit
5ce5a488d1
@ -22,10 +22,10 @@ class ODS implements EscaperInterface
|
|||||||
// 'ENT_DISALLOWED' ensures that invalid characters in the given document type are replaced.
|
// 'ENT_DISALLOWED' ensures that invalid characters in the given document type are replaced.
|
||||||
// Otherwise control characters like a vertical tab "\v" will make the XML document unreadable by the XML processor
|
// Otherwise control characters like a vertical tab "\v" will make the XML document unreadable by the XML processor
|
||||||
// @link https://github.com/box/spout/issues/329
|
// @link https://github.com/box/spout/issues/329
|
||||||
$replacedString = htmlspecialchars($string, ENT_QUOTES | ENT_DISALLOWED);
|
$replacedString = htmlspecialchars($string, ENT_QUOTES | ENT_DISALLOWED, 'UTF-8');
|
||||||
} else {
|
} else {
|
||||||
// We are on hhvm or any other engine that does not support ENT_DISALLOWED.
|
// We are on hhvm or any other engine that does not support ENT_DISALLOWED.
|
||||||
$escapedString = htmlspecialchars($string, ENT_QUOTES);
|
$escapedString = htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
// control characters values are from 0 to 1F (hex values) in the ASCII table
|
// control characters values are from 0 to 1F (hex values) in the ASCII table
|
||||||
// some characters should not be escaped though: "\t", "\r" and "\n".
|
// some characters should not be escaped though: "\t", "\r" and "\n".
|
||||||
|
@ -47,7 +47,7 @@ class XLSX implements EscaperInterface
|
|||||||
$escapedString = $this->escapeControlCharacters($string);
|
$escapedString = $this->escapeControlCharacters($string);
|
||||||
// @NOTE: Using ENT_QUOTES as XML entities ('<', '>', '&') as well as
|
// @NOTE: Using ENT_QUOTES as XML entities ('<', '>', '&') as well as
|
||||||
// single/double quotes (for XML attributes) need to be encoded.
|
// single/double quotes (for XML attributes) need to be encoded.
|
||||||
$escapedString = htmlspecialchars($escapedString, ENT_QUOTES);
|
$escapedString = htmlspecialchars($escapedString, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
return $escapedString;
|
return $escapedString;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user