Skip to content

Commit

Permalink
[BUGFIX] #578: fix issues with decoding chinese characters
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryd committed Feb 26, 2018
1 parent 4c99eac commit da9f081
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Classes/Decoder/UrlDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1340,6 +1340,14 @@ protected function putToPathCache(PathCacheEntry $newCacheEntry) {
if ($cacheEntry->getExpiration() !== 0) {
$cacheEntry->setExpiration(0);
}

// https://github.com/dmitryd/typo3-realurl/issues/578
$pathSegments = explode('/', $pagePath);
array_walk($pathSegments, function(&$segment) {
$segment = rawurlencode($this->utility->convertToSafeString($segment, $this->separatorCharacter));
});
$pagePath = implode('/', $pathSegments);

$cacheEntry->setPagePath($pagePath);
$this->cache->putPathToCache($cacheEntry);
}
Expand Down Expand Up @@ -1501,7 +1509,13 @@ protected function searchPathInCache(array &$pathSegments) {
$removedSegments = array();

do {
$path = implode('/', $pathSegments);
// https://github.com/dmitryd/typo3-realurl/issues/578
$pathSegmentsCopy = $pathSegments;
array_walk($pathSegmentsCopy, function(&$segment) {
$segment = rawurlencode($this->utility->convertToSafeString($segment, $this->separatorCharacter));
});
$path = implode('/', $pathSegmentsCopy);

// Since we know nothing about mount point at this stage, we exclude it from search by passing null as the second argument
$cacheEntry = $this->cache->getPathFromCacheByPagePath($this->rootPageId, $this->detectedLanguageId, null, $path);
if ($cacheEntry) {
Expand Down

0 comments on commit da9f081

Please sign in to comment.