|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27018 urlencode should not do non-ascii characters
Submitted: 2004-01-23 07:21 UTC Modified: 2004-01-24 08:43 UTC
From: vesely at tana dot it Assigned:
Status: Not a bug Package: URL related
PHP Version: Irrelevant OS: Irrelevant
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: vesely at tana dot it
New email:
PHP Version: OS:


 [2004-01-23 07:21 UTC] vesely at tana dot it
is it possible to reopen bug 6173?

Briefly, national characters are not field
separators in any url scheme. If they are
urlencoded, they may be traslated the wrong
way by users with incompatible code tables.

The answer to bug 6173 cites rfc1738, which is 10
years old and also says that

"   A mailto URL takes the form:
"      mailto:<rfc822-addr-spec>

The bug is relevant for urls like
that already violate rfc1738.

I prepared a test page in

The problem could be solved by adding a function to
support rfc1342, that must be called before rawurlencode.

Thank you for your patience

Reproduce code:
rawurlencode("? is not e")

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-23 17:05 UTC]
Use mb_encode_mimeheader() / iconv_mime_encode()

just RTFM.

 [2004-01-24 08:43 UTC] vesely at tana dot it
iconv_mime_encode would be nearly fine for me
(until I don't use multy-byte) except that it
writes "Subject: blah" a la SMTP. I will have
to remove the leading "Subject: ", [raw]urlencode
the "blah" and append the result to the url,
after an "&amp;Subject=". And will I trust using
substr($iconverted,9) or should I use a regex
to match the colon?

Please... :-) Nasty as national chars in headers are,
if at least they could be used correctly life might
be better. And since much html is created using
PHP and url-functions, a well documented dedicated
function may improve overall conformancy. In facts
many programmers --I for one-- are not sure what is
the correct encoding of a mailto tags among the three
on my test page.

BTW, why configure doesn't include iconv automatically?

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 10:01:31 2024 UTC