note 85130 added to function.rawurlencode
| From: | herenvardo at gmail dot com | Date: | Fri, 15 Aug 2008 23:11:41 +0000 |
| Subject: | note 85130 added to function.rawurlencode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143540@lists.php.net to get a copy of this message | ||
I have to mention something about javier's post: the issue you are experiencing only happens
because you are using ISO-8859-1 (a.k.a. ISO-LATIN-1) encoding, which is an extension of ASCII using
the values 128-255 for latin specific characters (these characters are NOT part of ASCII). To say
somethig like 0xF1 is the correct value for "ñ" in ASCII is wrong: any value equal or
higher than 0x80 is invalid in ASCII; and there is no "correct" value for "ñ"
in ASCII because the ASCII character set does not include that character.
These encode/decode functions are designed to work on UTF-8, which is an ASCII-compatible encoding
for Unicode, thus being able to represent the entire Unicode character range.
The main point is: the "ñ" you get is the 0xC3 0xB1 sequence, interpreted as two
single-byte ISO-8859-1 characters; but if you interpret them as UTF-8, they indeed represent
"ñ". If you are working with the latin character set and encoding, then you are fine
with your method (which is essentially a utf-8 => iso-latin-1 converter).
For anybody who is using UTF-8 enconding, check if there is any issue before you use a method like
javier's: these multi-byte values are actually the right way to represent any non-ASCII
character on UTF-8.
For deeper details on the UTF-8 and ISO-8859-1 encodings, take a look at wikipedia:
http://en.wikipedia.org/wiki/UTF-8
http://en.wikipedia.org/wiki/ISO-8859-1
----
Server IP: 193.95.141.37
Probable Submitter: 89.19.74.255
----
Manual Page -- http://www.php.net/manual/en/function.rawurlencode.php
Edit -- https://master.php.net/note/edit/85130
Del: integrated -- https://master.php.net/note/delete/85130/integrated
Del: useless -- https://master.php.net/note/delete/85130/useless
Del: bad code -- https://master.php.net/note/delete/85130/bad+code
Del: spam -- https://master.php.net/note/delete/85130/spam
Del: non-english -- https://master.php.net/note/delete/85130/non-english
Del: in docs -- https://master.php.net/note/delete/85130/in+docs
Del: other reasons-- https://master.php.net/note/delete/85130
Reject -- https://master.php.net/note/reject/85130
Search -- https://master.php.net/manage/user-notes.php