rfc2396

Encode and Decode rfc2396 URLs

萝らか妹 提交于 2019-12-18 02:46:17
问题 What is the best way to encode URL strings such that they are rfc2396 compliant and to decode a rfc2396 compliant string such that for example %20 is replaced with a space character? edit: URLEncoder and URLDecoder classes do not encode/decode rfc2396 compliant URLs, they encode to a MIME type of application/x-www-form-urlencoded which is used to encode HTML form parameter data. 回答1: Use the URI class as follows: URI uri = new URI("http", "//www.someurl.com/has spaces in url", null); URL url

What is RFC-compliant URI

让人想犯罪 __ 提交于 2019-12-12 11:16:37
问题 While going through features of .NET framework 4.5, I found that it supports RFC-compliant URIs. What does it mean to have RFC-compliant URI support? 回答1: RFC is a set of internet standards that define various aspects of internet protocols - in your case the standard format of an URI. You can find the relevant standard here: http://www.ietf.org/rfc/rfc2396.txt RFC 2396 defines explicitly what are the parts that make up an URI (for example the scheme, authority, path etc.) and what are the

Are angle brackets valid in data URIs?

我们两清 提交于 2019-12-11 08:37:57
问题 I've been reading about Data URIs which has the following example of a valid data URI: data:text/html,<script>alert('hi');</script> However reading through RFC 2397 I have found the following: dataurl := "data:" [ mediatype ] [ ";base64" ] "," data mediatype := [ type "/" subtype ] *( ";" parameter ) data := *urlchar parameter := attribute "=" value where "urlchar" is imported from RFC2396 From what I understood is that urlchar should be what is in Section 2.4.3 of RFC2396, where it notes the

Encode and Decode rfc2396 URLs

♀尐吖头ヾ 提交于 2019-11-28 23:45:04
What is the best way to encode URL strings such that they are rfc2396 compliant and to decode a rfc2396 compliant string such that for example %20 is replaced with a space character? edit: URLEncoder and URLDecoder classes do not encode/decode rfc2396 compliant URLs, they encode to a MIME type of application/x-www-form-urlencoded which is used to encode HTML form parameter data. Use the URI class as follows: URI uri = new URI("http", "//www.someurl.com/has spaces in url", null); URL url = uri.toURL(); or if you want a String: String urlString = uri.toASCIIString(); Your component parts,

How do I encode URI parameter values?

穿精又带淫゛_ 提交于 2019-11-26 16:09:14
I want to send a URI as the value of a query/matrix parameter. Before I can append it to an existing URI, I need to encode it according to RFC 2396. For example, given the input: http://google.com/resource?key=value1 & value2 I expect the output: http%3a%2f%2fgoogle.com%2fresource%3fkey%3dvalue1%2520%26%2520value2 Neither java.net.URLEncoder nor java.net.URI will generate the right output. URLEncoder is meant for HTML form encoding which is not the same as RFC 2396. URI has no mechanism for encoding a single value at a time so it has no way of knowing that value1 and value2 are part of the

How do I encode URI parameter values?

孤者浪人 提交于 2019-11-26 06:02:28
问题 I want to send a URI as the value of a query/matrix parameter. Before I can append it to an existing URI, I need to encode it according to RFC 2396. For example, given the input: http://google.com/resource?key=value1 & value2 I expect the output: http%3a%2f%2fgoogle.com%2fresource%3fkey%3dvalue1%2520%26%2520value2 Neither java.net.URLEncoder nor java.net.URI will generate the right output. URLEncoder is meant for HTML form encoding which is not the same as RFC 2396. URI has no mechanism for