php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36641 space encoding in urlencode / rawurlencode
Submitted: 2006-03-07 09:18 UTC Modified: 2006-03-07 10:06 UTC
From: sreinecke at feverxl dot de Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: all
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sreinecke at feverxl dot de
New email:
PHP Version: OS:

 

 [2006-03-07 09:18 UTC] sreinecke at feverxl dot de
Description:
------------
urlencode documentation:

Returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits 

--> AND SPACES ENCODES AS PLUS (+) SIGNS <--. 

It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type. This DIFFERS from the RFC1738 encoding (see rawurlencode()) in that for historical reasons, 

--> SPACES ARE ENCODED AS PLUS (+) SIGNS. <--

...

Where is the difference?

Thank you,

Steffen

Reproduce code:
---------------
http://www.php.net/manual/en/function.urlencode.php

Expected result:
----------------
irrelevant

Actual result:
--------------
see description

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-07 09:35 UTC] vrana@php.net
urlencode() encodes space as +, RFC 1738 as %20.
 [2006-03-07 09:55 UTC] sreinecke at feverxl dot de
Yes, thats true. But the manual says wrongly that spaces are encoded as (+) signs in RFC1738.

see: http://www.php.net/manual/en/function.urlencode.php
 [2006-03-07 10:06 UTC] vrana@php.net
Read it as "It differs from RFC 1738 in THAT spaces are encoded as +". Otherwise sentense would be "It differs from RFC 1738 WHERE spaces are encoded". Maybe it's a bit ambiguous but clear from context.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 16:08:09 2025 UTC