public static function stringToUrl($string, $separator = '_', $encoding = 'UTF-8', $lower = false) {
        if (!Validate::isCharset($encoding))
            throw new \Exception('Encoding in\'t a valid charset type');
        $string = htmlentities(html_entity_decode($string, null, $encoding), ENT_NOQUOTES, $encoding);
        if ($lower)
            $string = strtolower($string);
        $search = array('#\&(.)(?:uml|circ|tilde|acute|grave|cedil|ring)\;#', '#\&(.{2})(?:lig)\;#', '#\&[a-z]+\;#', '#[^a-zA-Z0-9_]#', '#' . $separator . '+#');
        $replace = array('\1', '\1', '', $separator, $separator);
        return trim(preg_replace($search, $replace, $string), $separator);
    }