Be aware that rawurldecode does not warn you in any way if the output is nonvalid UTF-8.
For example if the input passed to the function is just "%C5", then since C is 1100 in binary, and UTF-8 characters starting with 110 should be followed by another character, the result of rawurldecode will be just a single byte (with value \xC5) which is not a correct UTF-8.
Confront this with for example Javascript which will warn you about it:
JAVASCRIPT:
decodeURI("%C5")
URIError: URI malformed
decodeURIComponent("%C5")
URIError: URI malformed
unescape("%C5")
"Å"
PHP:
var_dump(rawurldecode("%C5"))
string(1) "▒"
php -v
PHP 5.3.6 (cli) (built: Oct 4 2012 10:19:07)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH