Url encoded что это

HTML Кодирование URL

Единый указатель ресурса (англ. Uniform Resource Locator, URL) — это единообразный локатор (определитель местонахождения) ресурса.
Ранее URL назывался Universal Resource Locator — универсальный указатель ресурса. URL служит стандартизированным способом записи адреса ресурса в сети Интернет.

Структура URL

Изначально локатор URL был разработан как система для максимально естественного указания на местонахождение определенного ресурса в сети. URL должен был быть легко расширяемым и использовать лишь ограниченный набор символов ASCII (к примеру, пробел никогда не применяется в URL). В связи с этим, возникла следующая традиционная форма записи URL-адреса: Расшифровка записи:

Стандарт URL использует набор символов ASCII. Кодирование в URL заменяет небезопасные символы ASCII на символ «%» и следующие две шестнадцатеричные цифры соответствующего значения в наборе символов ISO-8859-1.
C момента своего изобретения и по сей день стандарт URL обладает серьёзным недостатком — в нём можно использовать только ограниченный набор символов: латинские буквы, цифры и лишь некоторые знаки пунктуации. Все другие символы необходимо перекодировать.
Например, перекодироваться должны буквы кириллицы, буквы с диакритическими знаками, лигатуры, иероглифы.
Перекодирующая кодировка называется URL-encoding, URLencoded или percent‐encoding.
URL-адреса не могут содержать пробелы. Кодирование URL-адрес, как правило заменяет каждый пробел знаком плюс (+), или %20. Символы кириллицы URL кодирование заменяет на соответствующие комбинации % и код символа.

Например, строка вида:

Преобразование происходит в два этапа: сначала каждый символ кириллицы кодируется в UTF-8 в последовательность из двух байтов, а затем каждый байт этой последовательности записывается в шестнадцатеричном представлении с предшествующим знаком процента (%):

URL-коды символов UTF-8 представлены в Таблице URL кодов символов UTF-8
URL-коды специальных управляющих символов таблицы ASCII (диапазон 00-31, плюс 127), символов ISO-Latin (диапазон 128-255), зарезервированных символов (знак доллара, амперсанд, плюс, слэш, двоеточие, точка с запятой, знак равенства, знак вопроса, знак эт (собака)), небезопасных символов (пробел, кавычки, знак меньше, знак больше, знак диез, знак проценты, фигурные скобки, прямой слэш, обратный слэш, тильда, квдратные скобки, гравис) представлены в Таблице символов кодирования URL

Источник

Encode to URL-encoded format

Encode files to URL-encoded format

Meet URL Decode and Encode, a simple online tool that does exactly what it says: decodes from URL-encoding as well as encodes into it quickly and easily. URL-encode your data without hassles or decode it into a human-readable format.

URL-encoding, also known as «percent-encoding», is a mechanism for encoding information in a Uniform Resource Identifier (URI). Although it is known as URL-encoding it is, in fact, used more generally within the main Uniform Resource Identifier (URI) set, which includes both Uniform Resource Locator (URL) and Uniform Resource Name (URN). As such it is also used in the preparation of data of the «application/x-www-form-urlencoded» media type, as is often employed in the submission of HTML form data in HTTP requests.

All communications with our servers come through secure SSL encrypted connections (https). We delete uploaded files from our servers immediately after being processed and the resulting downloadable file is deleted right after the first download attempt or 15 minutes of inactivity (whichever is shorter). We do not keep or inspect the contents of the submitted data or uploaded files in any way. Read our privacy policy below for more details.

Our tool is free to use. From now on, you don’t need to download any software for such simple tasks.

Details of the URL-encoding

Types of URI characters

The characters allowed in a URI are either reserved or unreserved (or a percent character as part of a percent-encoding). Reserved characters are characters that sometimes have special meaning. For example, forward slash characters are used to separate different parts of a URL (or more generally, a URI). Unreserved characters have no such special meanings. Using percent-encoding, reserved characters are represented using special character sequences. The sets of reserved and unreserved characters and the circumstances under which certain reserved characters have special meaning have changed slightly with each new revision of specifications that govern URIs and URI schemes.

Other characters in a URI must be percent encoded.

Percent-encoding reserved characters

When a character from the reserved set (a «reserved character») has special meaning (a «reserved purpose») in a particular context and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. Percent-encoding a reserved character means converting the character to its corresponding byte value in ASCII and then representing that value as a pair of hexadecimal digits. The digits, preceded by a percent sign («%»), are then used in the URI in place of the reserved character. (For a non-ASCII character, it is typically converted to its byte sequence in UTF-8, and then each byte value is represented as above.)

The reserved character «/», for example, if used in the «path» component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, «/» needs to be in a path segment, then the three characters «%2F» (or «%2f») must be used in the segment instead of a «/».

RFC 3986 section 2.3 Unreserved Characters (January 2005)
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789_.
Reserved characters after percent-encoding
!#$&()*+,/:;=?@[]
%21%23%24%26%27%28%29%2A%2B%2C%2F%3A%3B%3D%3F%40%5B%5D

Reserved characters that have no reserved purpose in a particular context may also be percent-encoded but are not semantically different from other characters.

In the «query» component of a URI (the part after a «?» character), for example, «/» is still considered a reserved character but it normally has no reserved purpose (unless a particular URI scheme says otherwise). The character does not need to be percent-encoded when it has no reserved purpose.

URIs that differ only by whether a reserved character is percent-encoded or not are normally considered not equivalent (denoting the same resource) unless it is the case that the reserved characters in question have no reserved purpose. This determination is dependent upon the rules established for reserved characters by individual URI schemes.

Percent-encoding unreserved characters

Characters from the unreserved set never need to be percent-encoded.

URIs that differ only by whether an unreserved character is percent-encoded or not are equivalent by definition, but URI processors, in practice, may not always treat them equivalently. For example, URI consumers shouldn’t treat «%41» differently from «A» («%41» is the percent-encoding of «A») or «%7E» differently from «

«, but some do. For maximum interoperability, URI producers are therefore discouraged from percent-encoding unreserved characters.

Percent-encoding the percent character

Because the percent («%») character serves as the indicator for percent-encoded octets, it must be percent-encoded as «%25» for that octet to be used as data within a URI.

Percent-encoding arbitrary data

Most URI schemes involve the representation of arbitrary data, such as an IP address or file system path, as components of a URI. URI scheme specifications should, but often don’t, provide an explicit mapping between URI characters and all possible data values being represented by those characters.

Since the publication of RFC 1738 in 1994, it has been specified that schemes that provide for the representation of binary data in a URI must divide the data into 8-bit bytes and percent-encode each byte in the same manner as above. Byte value 0F (hexadecimal), for example, should be represented by «%0F», but byte value 41 (hexadecimal) can be represented by «A», or «%41». The use of unencoded characters for alphanumeric and other unreserved characters is typically preferred because it results in shorter URLs.

The procedure for percent-encoding binary data has often been extrapolated, sometimes inappropriately or without being fully specified, to apply to character-based data. In the World Wide Web’s formative years, when dealing with data characters in the ASCII repertoire and using their corresponding bytes in ASCII as the basis for determining percent-encoded sequences, this practice was relatively harmless; many people assumed that characters and bytes mapped one-to-one and were interchangeable. However, the need to represent characters outside the ASCII range grew quickly and URI schemes and protocols often failed to provide standard rules for preparing character data for inclusion in a URI. Web applications consequently began using different multi-byte, stateful, and other non-ASCII-compatible encodings as the basis for percent-encoding, leading to ambiguities as well as difficulty interpreting URIs reliably.

For example, many URI schemes and protocols based on RFCs 1738 and 2396 presume that the data characters will be converted to bytes according to some unspecified character encoding before being represented in a URI by unreserved characters or percent-encoded bytes. If the scheme does not allow the URI to provide a hint as to what encoding was used, or if the encoding conflicts with the use of ASCII to percent-encode reserved and unreserved characters, then the URI cannot be reliably interpreted. Some schemes fail to account for encoding at all and instead just suggest that data characters map directly to URI characters, which leaves it up to individual users to decide whether and how to percent-encode data characters that are in neither the reserved nor unreserved sets.

Источник

urlencode

(PHP 4, PHP 5, PHP 7, PHP 8)

urlencode — URL-кодирование строки

Описание

Эта функция удобна, когда закодированная строка будет использоваться в запросе, как часть URL, в качестве удобного способа передачи переменных на следующую страницу.

Список параметров

Строка, которая должна быть закодирована.

Возвращаемые значения

Примеры

Пример #1 Пример использования urlencode()

Пример #2 Пример использования urlencode() и htmlentities()

Примечания

Будьте внимательны с переменными, которые могут совпадать с элементами HTML. Такие сущности как &amp, &copy и &pound разбираются браузером и используется как реальная сущность, а не желаемое имя переменной. Это очевидный конфликт, на который W3C указывает в течение многих лет. Смотрите подробности: » http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.2

Смотрите также

User Contributed Notes 25 notes

urlencode function and rawurlencode are mostly based on RFC 1738.

However, since 2005 the current RFC in use for URIs standard is RFC 3986.

Here is a function to encode URLs according to RFC 3986.

I needed encoding and decoding for UTF8 urls, I came up with these very simple fuctions. Hope this helps!

Don’t use urlencode() or urldecode() if the text includes an email address, as it destroys the «+» character, a perfectly valid email address character.

Unless you’re certain that you won’t be encoding email addresses AND you need the readability provided by the non-standard «+» usage, instead always use use rawurlencode() or rawurldecode().

I needed a function in PHP to do the same job as the complete escape function in Javascript. It took me some time not to find it. But findaly I decided to write my own code. So just to save time:

urlencode is useful when using certain URL shortener services.

The returned URL from the shortener may be truncated if not encoded. Ensure the URL is encoded before passing it to a shortener.

(tilde), while urlencode does.

Below is our jsonform source code in mongo db which consists a lot of double quotes. we are able to pass this source code to the ajax form submit function by using php urlencode :

If you want to pass a url with parameters as a value IN a url AND through a javascript function, such as.

. pass the url value through the PHP urlencode() function twice, like this.

However, some weird things happen when dealing with characters like (these are HTML entities): ‼ ▐ ┐and Θ have weird things going on.

If you try to pass one in Internet Explorer, IE will *disable* the submit button. Firefox, however, does something weirder: it will convert it to it’s HTML entity. It will display properly, but only when you don’t convert entities.

The point? Be careful with decorative characters.

This very simple function makes an valid parameters part of an URL, to me it looks like several of the other versions here are decoding wrongly as they do not convert & seperating the variables into &.

$vars=array(‘name’ => ‘tore’,’action’ => ‘sell&buy’);
echo MakeRequestUrl($vars);

Will output: action=sell%26buy&name=tore

Constructing hyperlinks safely HOW-TO:

= ‘machine/generated/part’ ;
$url_parameter1 = ‘this is a string’ ;
$url_parameter2 = ‘special/weird «$characters»‘ ;

$link_label = «Click here & you’ll be » ;

Shortly:
— Use urlencode for all GET parameters (things that come after each «=»).
— Use rawurlencode for parts that come before «?».
— Use htmlspecialchars for HTML tag parameters and HTML text content.

look on index.php
array (size=0)
empty
test-bla-bla-4%253E2-y-3%253C6

look on test-bla-bla-4%253E2-y-3%253C6
array (size=1)
‘token’ => string ‘bla-bla-4>2-y-3

Simple static class for array URL encoding

/**
*
* URL Encoding class
* Use : urlencode_array::go() as function
*
*/
class urlencode_array
<

Источник

Url encoded что это

Попробуйте ввести другие данные и опять нажмите Submit (‘Отправить’)

Функции кодирования URL-адресов

В JavaScript, PHP и ASP существуют функции, которые можно использовать для URL-кодирования строки.

PHP имеет функцию rawurlencode(), а ASP имеет функцию Server.URLEncode().

В JavaScript можно использовать функцию encodeURIComponent().

Нажмите кнопку ‘URL Encode’, чтобы увидеть, как функция JavaScript кодирует текст.

Примечание: Функция JavaScript кодирует пробел как %20.

ASCII Кодировки. Справочник

Ваш браузер будет кодировать входящие данные в соответствие набору символов, который используется на веб-странице.

СимволИз Windows-1252Из UTF-8
space%20%20
!%21%21
%22%22
#%23%23
$%24%24
%%25%25
&%26%26
%27%27
(%28%28
)%29%29
*%2A%2A
+%2B%2B
,%2C%2C
%2D%2D
.%2E%2E
/%2F%2F
0%30%30
1%31%31
2%32%32
3%33%33
4%34%34
5%35%35
6%36%36
7%37%37
8%38%38
9%39%39
:%3A%3A
;%3B%3B
%3E%3E
?%3F%3F
@%40%40
A%41%41
B%42%42
C%43%43
D%44%44
E%45%45
F%46%46
G%47%47
H%48%48
I%49%49
J%4A%4A
K%4B%4B
L%4C%4C
M%4D%4D
N%4E%4E
O%4F%4F
P%50%50
Q%51%51
R%52%52
S%53%53
T%54%54
U%55%55
V%56%56
W%57%57
X%58%58
Y%59%59
Z%5A%5A
[%5B%5B
\%5C%5C
]%5D%5D
^%5E%5E
_%5F%5F
`%60%60
a%61%61
b%62%62
c%63%63
d%64%64
e%65%65
f%66%66
g%67%67
h%68%68
i%69%69
j%6A%6A
k%6B%6B
l%6C%6C
m%6D%6D
n%6E%6E
o%6F%6F
p%70%70
q%71%71
r%72%72
s%73%73
t%74%74
u%75%75
v%76%76
w%77%77
x%78%78
y%79%79
z%7A%7A
<%7B%7B
|%7C%7C
>%7D%7D
%7E%7E
%7F%7F
`%80%E2%82%AC
%81%81
%82%E2%80%9A
ƒ%83%C6%92
%84%E2%80%9E
%85%E2%80%A6
%86%E2%80%A0
%87%E2%80%A1
ˆ%88%CB%86
%89%E2%80%B0
Š%8A%C5%A0
%8B%E2%80%B9
Œ%8C%C5%92
%8D%C5%8D
Ž%8E%C5%BD
%8F%8F
%90%C2%90
%91%E2%80%98
%92%E2%80%99
%93%E2%80%9C
%94%E2%80%9D
%95%E2%80%A2
%96%E2%80%93
%97%E2%80%94
˜%98%CB%9C
%99%E2%84
š%9A%C5%A1
%9B%E2%80
œ%9C%C5%93
%9D%9D
ž%9E%C5%BE
Ÿ%9F%C5%B8
%A0%C2%A0
¡%A1%C2%A1
¢%A2%C2%A2
£%A3%C2%A3
¤%A4%C2%A4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%C3%BC
ý%FD%C3%BD
þ%FE%C3%BE
ÿ%FF%C3%BF

Справочник URL кодировок

Набор символов ASCII %00-%1F сначала разрабатывался для управления аппаратными устройствами.

Наборы символов не имеют никакого отношения к URL-адресам.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *