Skip to content

Conversation

@dg
Copy link
Member

@dg dg commented Dec 21, 2014

Closes #32

@JanTvrdik
Copy link
Contributor

Nice! The following seems to have slightly better worse-case:

preg_replace_callback(
    '#(%(?:' . substr(chunk_split(bin2hex($reserved), 2, '|'), 0, -1) . '))++#i',
    function($m) {
        return rawurlencode(strtoupper($m[0]));
    },
    $s
);

On the other hand – its slower for common inputs so probably not worth it.

@dg
Copy link
Member Author

dg commented Dec 21, 2014

Reserved characters are rare, so probably not.

dg added a commit that referenced this pull request Dec 21, 2014
@dg dg merged commit cdfd0ab into nette:master Dec 21, 2014
@dg dg deleted the pull-unescape branch December 21, 2014 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants