url-encoding

urlencoded Forward slash is breaking URL

 ̄綄美尐妖づ 提交于 2019-11-26 11:14:38
About the system I have URLs of this format in my project:- http://project_name/browse_by_exam/type/tutor_search/keyword/class/new_search/1/search_exam/0/search_subject/0 Where keyword/class pair means search with "class" keyword. I have a common index.php file which executes for every module in the project. There is only a rewrite rule to remove the index.php from URL:- RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php [L,QSA] I am using urlencode() while preparing the search URL and

GETting a URL with an url-encoded slash

a 夏天 提交于 2019-11-26 10:30:53
I want to send a HTTP GET to http://example.com/%2F . My first guess would be something like this: using (WebClient webClient = new WebClient()) { webClient.DownloadData("http://example.com/%2F"); } Unfortunately, I can see that what is actually sent on the wire is: GET // HTTP/1.1 Host: example.com Connection: Keep-Alive So http://example.com/%2F gets translated into http://example.com// before transmitting it. Is there a way to actually send this GET-request? The OCSP-protocol mandates sending the url-encoding of a base-64-encoding when using OCSP over HTTP/GET, so it is necessary to send an

How to find out if string has already been URL encoded?

懵懂的女人 提交于 2019-11-26 08:20:01
问题 How could I check if string has already been encoded? For example, if I encode TEST== , I get TEST%3D%3D . If I again encode last string, I get TEST%253D%253D , I would have to know before doing that if it is already encoded... I have encoded parameters saved, and I need to search for them. I don\'t know for input parameters, what will they be - encoded or not, so I have to know if I have to encode or decode them before search. 回答1: Decode, compare to original. If it does differ, original is

A html space is showing as %2520 instead of %20

天涯浪子 提交于 2019-11-26 08:15:01
问题 Passing a filename to the firefox browser causes it to replace spaces with %2520 instead of %20 . I have the following HTML in a file called myhtml.html : <img src=\"C:\\Documents and Settings\\screenshots\\Image01.png\"/> When I load myhtml.html into firefox, the image shows up as a broken image. So I right click the link to view the picture and it shows this modified URL: file:///c:/Documents%2520and%2520Settings/screenshots/Image01.png ^ ^-----Firefox changed my space to %2520. What the

How to encode URL to avoid special characters in Java? [duplicate]

旧城冷巷雨未停 提交于 2019-11-26 05:29:41
问题 This question already has answers here : HTTP URL Address Encoding in Java (25 answers) Closed last year . i need java code to encode URL to avoid special characters such as spaces and % and & ...etc 回答1: URL construction is tricky because different parts of the URL have different rules for what characters are allowed: for example, the plus sign is reserved in the query component of a URL because it represents a space, but in the path component of the URL, a plus sign has no special meaning

In a URL, should spaces be encoded using %20 or +? [duplicate]

♀尐吖头ヾ 提交于 2019-11-26 04:21:33
问题 This question already has answers here : URL encoding the space character: + or %20? (4 answers) Closed 3 years ago . In a URL, should I encode the spaces using %20 or + ? For example, in the following example, which one is correct? www.mydomain.com?type=xbox%20360 www.mydomain.com?type=xbox+360 Our company is leaning to the former, but using the Java method URLEncoder.encode(String, String) with \"xbox 360\" (and \"UTF-8\" ) returns the latter. So, what\'s the difference? 回答1: Form data (for

URL: Username with @

自闭症网瘾萝莉.ら 提交于 2019-11-26 03:09:59
问题 To send username and password with a URL, we use this scheme: http://username:password@www.my_site.com But my username is my_email@gmail.com . The problem is the @ . How can I solve it? 回答1: You need to URL encode the @ as %40. 回答2: Use %40 in your username instead of the @ symbol for the url encoding. It should pass it properly then. 回答3: Just do: http://my_email%40gmail.com:password@www.my_site.com I am quite surprised that problem was with username @ and not the password -usually this is

urlencode vs rawurlencode?

南楼画角 提交于 2019-11-26 01:43:42
问题 If I want to create a URL using a variable I have two choices to encode the string. urlencode() and rawurlencode() . What exactly are the differences and which is preferred? 回答1: It will depend on your purpose. If interoperability with other systems is important then it seems rawurlencode is the way to go. The one exception is legacy systems which expect the query string to follow form-encoding style of spaces encoded as + instead of %20 (in which case you need urlencode). rawurlencode

How to do URL decoding in Java?

旧时模样 提交于 2019-11-25 23:07:29
问题 In Java, I want to convert this: https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do%3Frequest_type To this: https://mywebsite/docs/english/site/mybook.do&request_type This is what I have so far: class StringUTF { public static void main(String[] args) { try{ String url = \"https%3A%2F%2Fmywebsite%2Fdocs%2Fenglish%2Fsite%2Fmybook.do\" + \"%3Frequest_type%3D%26type%3Dprivate\"; System.out.println(url+\"Hello World!------->\" + new String(url.getBytes(\"UTF-8\"),\"ASCII\")); } catch

URL encoding the space character: + or %20?

ぃ、小莉子 提交于 2019-11-25 22:06:50
问题 When is a space in a URL encoded to + , and when is it encoded to %20 ? 回答1: From Wikipedia (emphasis and link added): When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST, or, historically, via email. The encoding used by default is based on a very early version of the general URI percent-encoding rules, with a number of modifications such as newline normalization