I'm trying to understand the structure of a URL, and I'm seeing a lot of %2C
. I'm guessing this is a result of some encoding. What does that stand for?
This question is related to
url
url-encoding
It's the ASCII keycode in hexadecimal for a comma (,
).
You should use your language's URL encoding methods when placing strings in URLs.
You can see a handy list of characters with man ascii
. It has this compact diagram available for mapping hexadecimal codes to the character:
2 3 4 5 6 7
-------------
0: 0 @ P ` p
1: ! 1 A Q a q
2: " 2 B R b r
3: # 3 C S c s
4: $ 4 D T d t
5: % 5 E U e u
6: & 6 F V f v
7: ' 7 G W g w
8: ( 8 H X h x
9: ) 9 I Y i y
A: * : J Z j z
B: + ; K [ k {
C: , < L \ l |
D: - = M ] m }
E: . > N ^ n ~
F: / ? O _ o DEL
You can also quickly check a character's hexadecimal equivalent with:
$ echo -n , | xxd -p
2c
It's the ASCII keycode in hexadecimal for a comma (,).
i.e. , = %2C
like in my link suppose i want to order by two fields means in my link it will come like
order_by=id%2Cname which is equal to order_by=id,name .
The %2C
translates to a comma (,
). I saw this while searching for a sentence with a comma in it and on the url, instead of showing a comma, it had %2C
.
Simple & Easy answer,
The %2C means , comma in URL. when you add the String "abc,defg" in the url as parameter then that comma in the string which is abc , defg is changed to abc%2Cdefg .There is no need to worry about it.
In Firefox there is Ctrl+Shift+K for the Web console, then you type
;decodeURIComponent("%2c")
and you get the answer:
","
Source: Stackoverflow.com