Character Entities That Should be Encoded in URLs
URLs have a limited number of characters that you can use for domains, directories, and file names. These characters are:
A-Z, a-z, 0-9, -, ., _, ~, :, /, ?, #, [, ], @, !, $, &, ', (, ), *, +, ,, ; and =
Some of these characters have specific, reserved meanings and you can only use them in a URL for that purpose. Any other character in a URL or using a reserved character for a different use should be encoded with the following codes.
Characters With a Reserved Usage
The following table gives a list of the common characters that should not be written in URLs, except in their appropriate usage:
Character | Purpose in URL | Encoding |
---|---|---|
: | Separate protocol (http) from address | %3B |
/ | Separate domain and directories | %2F |
# | Separate anchors | %23 |
? | Separate query string | %3F |
& | Separate query elements | %24 |
@ | Separate username and password from domain | %40 |
% | Indicates an encoded character | %25 |
+ | Indicates a space | %2B |
~ | Indicates a user directory | %&E |
Characters You Should Always Encode in URLs
And this table lists some common characters you should not use in URLs at all unless you use the encoded version.
Note that there are many more characters on the “do not use” list that are not included here. If you need to use these characters you need to find out the URL encoding for them.
Character | Purpose in URL | Encoding |
---|---|---|
<space> | Invalid in URLs | %20 or + |
; | Invalid in URLs | %3B |
= | Invalid in URLs | %3D |
$ | Invalid in URLs | %26 |
, | Invalid in URLs | %2C |
< | Invalid in URLs | %3C |
> | Invalid in URLs | %3E |
^ | Invalid in URLs | %5E |
` | Invalid in URLs | %60 |
\ | Invalid in URLs | %5C |
[ | Invalid in URLs | %5B |
] | Invalid in URLs | %5D |
{ | Invalid in URLs | %7B |
} | Invalid in URLs | %7D |
| | Invalid in URLs | %7C |
" | Invalid in URLs | %22 |
'웹프로그래밍 > HTML, CSS' 카테고리의 다른 글
[HTML] excel 출력시 내용 줄바꿈 (0) | 2014.04.23 |
---|---|
HTML to Excel 엑셀출력 데이터타입 지정 (0) | 2013.11.07 |
[CSS] 웹 색상표 (0) | 2013.09.13 |
ie의 호환성보기 버튼 없애기 (0) | 2013.09.03 |
[CSS] 텍스트 잘리는부분 ...처리 (0) | 2012.04.11 |