protected function translateToUrlEncodedPath($generatedPathAsUtf8)
    {
        $iso88591Path = explode('/', $generatedPathAsUtf8);

        foreach ($iso88591Path as &$part) {
            // identify and skip schemes
            if (substr($part, -1) == ':') {
                continue;
            }

            // only encode and transliterate that which comes before the anchor
            $subparts = explode('#', $part);
            
            if (extension_loaded('iconv')) {
                $subparts[0] = iconv('UTF-8', 'ASCII//TRANSLIT', $subparts[0]);
            }
            $subparts[0] = urlencode($subparts[0]);
            
            $part = implode('#', $subparts);
        }

        return implode('/', $iso88591Path);
    }