note 114205 added to function.rawurldecode

From: Date: Fri, 24 Jan 2014 07:59:19 +0000
Subject: note 114205 added to function.rawurldecode
Groups: php.notes 
Request: Send a blank email to php-notes+get-198328@lists.php.net to get a copy of this message
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 ---- Server IP: 46.17.113.2 Probable Submitter: 195.88.186.2 ---- Manual Page -- http://php.net/manual/en/function.rawurldecode.php Edit -- https://master.php.net/note/edit/114205 Del: integrated -- https://master.php.net/note/delete/114205/integrated Del: useless -- https://master.php.net/note/delete/114205/useless Del: bad code -- https://master.php.net/note/delete/114205/bad+code Del: spam -- https://master.php.net/note/delete/114205/spam Del: non-english -- https://master.php.net/note/delete/114205/non-english Del: in docs -- https://master.php.net/note/delete/114205/in+docs Del: other reasons-- https://master.php.net/note/delete/114205 Reject -- https://master.php.net/note/reject/114205 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198328) next »