mirror of
https://github.com/getgrav/grav.git
synced 2026-07-20 05:21:56 +02:00
Fixed encoding problems when PHP INI setting default_charset is not utf-8 (Grav 1.7 edition) [#2154]
This commit is contained in:
@@ -400,7 +400,7 @@ class Pages
|
||||
$param = $uri->param(rawurlencode($taxonomy));
|
||||
$items = is_string($param) ? explode(',', $param) : [];
|
||||
foreach ($items as $item) {
|
||||
$params['taxonomies'][$taxonomy][] = htmlspecialchars_decode(rawurldecode($item), ENT_QUOTES);
|
||||
$params['taxonomies'][$taxonomy][] = htmlspecialchars_decode(rawurldecode($item), ENT_QUOTES | ENT_HTML5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,12 +635,12 @@ trait PageContentTrait
|
||||
|
||||
// Only return string but not html, wrap whatever html tag you want when using.
|
||||
if ($textOnly) {
|
||||
return mb_strimwidth($content, 0, $size, '...', 'utf-8');
|
||||
return mb_strimwidth($content, 0, $size, '...', 'UTF-8');
|
||||
}
|
||||
|
||||
$summary = Utils::truncateHTML($content, $size);
|
||||
|
||||
return html_entity_decode($summary);
|
||||
return html_entity_decode($summary, ENT_COMPAT | ENT_HTML5, 'UTF-8');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -627,7 +627,7 @@ trait PageLegacyTrait
|
||||
$this->_metadata[$prop_key] = [
|
||||
'name' => $prop_key,
|
||||
'property' => $prop_key,
|
||||
'content' => htmlspecialchars($prop_value, ENT_QUOTES, 'UTF-8')
|
||||
'content' => htmlspecialchars($prop_value, ENT_QUOTES | ENT_HTML5, 'UTF-8')
|
||||
];
|
||||
}
|
||||
} elseif ($value) {
|
||||
@@ -635,16 +635,16 @@ trait PageLegacyTrait
|
||||
if (\in_array($key, $header_tag_http_equivs, true)) {
|
||||
$this->_metadata[$key] = [
|
||||
'http_equiv' => $key,
|
||||
'content' => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')
|
||||
'content' => htmlspecialchars($value, ENT_QUOTES | ENT_HTML5, 'UTF-8')
|
||||
];
|
||||
} elseif ($key === 'charset') {
|
||||
$this->_metadata[$key] = ['charset' => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')];
|
||||
$this->_metadata[$key] = ['charset' => htmlspecialchars($value, ENT_QUOTES | ENT_HTML5, 'UTF-8')];
|
||||
} else {
|
||||
// if it's a social metadata with separator, render as property
|
||||
$separator = strpos($key, ':');
|
||||
$hasSeparator = $separator && $separator < strlen($key) - 1;
|
||||
$entry = [
|
||||
'content' => htmlspecialchars($value, ENT_QUOTES, 'UTF-8')
|
||||
'content' => htmlspecialchars($value, ENT_QUOTES | ENT_HTML5, 'UTF-8')
|
||||
];
|
||||
|
||||
if ($hasSeparator && !Utils::startsWith($key, 'twitter')) {
|
||||
|
||||
Reference in New Issue
Block a user