url-encoding

how do i decode/encode the url parameters for the new google maps?

落花浮王杯 提交于 2019-11-27 01:46:26
问题 Im trying to figure out how to extract the lat/long of the start/end in a google maps directions link that looks like this: https://www.google.com/maps/preview#!data=!1m4!1m3!1d189334!2d-96.03687!3d36.1250439!4m21!3m20!1m4!3m2!3d36.0748342!4d-95.8040972!6e2!1m5!1s1331-1399+E+14th+St%2C+Tulsa%2C+OK+74120!2s0x87b6ec9a1679f9e5%3A0x6e70df70feebbb5e!3m2!3d36.1424613!4d-95.9736986!3m8!1m3!1d189334!2d-96.03687!3d36.1250439!3m2!1i1366!2i705!4f13.1&fid=0 Im guessing the "!" is a separator between

URL encoding/decoding with Python

China☆狼群 提交于 2019-11-27 00:06:15
问题 I am trying to encode and store, and decode arguments in Python and getting lost somewhere along the way. Here are my steps: 1) I use google toolkit's gtm_stringByEscapingForURLArgument to convert an NSString properly for passing into HTTP arguments. 2) On my server (python), I store these string arguments as something like u'1234567890-/:;()$&@".,?!\'[]{}#%^*+=_\\|~<>\u20ac\xa3\xa5\u2022.,?!\'' (note that these are the standard keys on an iphone keypad in the "123" view and the "#+=" view,

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

左心房为你撑大大i 提交于 2019-11-26 22:20:14
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. Decode, compare to original. If it does differ, original is encoded. If it doesn't differ, original isn't encoded. But still it says nothing about whether the newly

Sharing a URL with a query string on Twitter

雨燕双飞 提交于 2019-11-26 18:53:02
问题 I'm trying to put a Twitter share link in an email. Because this is in an email I can't rely on JavaScript, and have to use the "Build Your Own" Tweet button. For example, sharing a link to Google: <a href="http://www.twitter.com/share?url=http://www.google.com/>Tweet</a> This works fine. The problem I'm having is when the URL has a query string. <a href="http://www.twitter.com/share?url=http://mysite.org/foo.htm?bar=123&baz=456">Tweet</a> URLs with query strings confuse Twitter's URL

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

与世无争的帅哥 提交于 2019-11-26 17:35:50
This question already has an answer here: HTTP URL Address Encoding in Java 24 answers i need java code to encode URL to avoid special characters such as spaces and % and & ...etc 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 and spaces are encoded as "%20". RFC 2396 explains (in section 2.4.2) that a complete URL is always in its encoded form: you take

Detect the URI encoding automatically in Tomcat

末鹿安然 提交于 2019-11-26 16:10:34
问题 I have an instance of Apache Tomcat 6.x running, and I want it to interpret the character set of incoming URLs a little more intelligent than the default behavior. In particular, I want to achieve the following mapping: So%DFe => Soße So%C3%9Fe => Soße So%DF%C3%9F => (error) The bevavior I want could be described as "try to decode the byte stream as UTF-8, and if it doesn't work assume ISO-8859-1". Simply using the URIEncoding configuration doesn't work in that case. So how can I configure

Should I URL-encode POST data?

强颜欢笑 提交于 2019-11-26 15:46:27
I'm POSTing data to an external API (using PHP, if it's relevant). Should I URL-encode the POST variables that I pass? Or do I only need to URL-encode GET data? Thanks! UPDATE: This is my PHP, in case it is relevant: $fields = array( 'mediaupload'=>$file_field, 'username'=>urlencode($_POST["username"]), 'password'=>urlencode($_POST["password"]), 'latitude'=>urlencode($_POST["latitude"]), 'longitude'=>urlencode($_POST["longitude"]), 'datetime'=>urlencode($_POST["datetime"]), 'category'=>urlencode($_POST["category"]), 'metacategory'=>urlencode($_POST["metacategory"]), 'caption'=>($_POST[

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

核能气质少年 提交于 2019-11-26 15:20:23
This question already has an answer here: URL encoding the space character: + or %20? 4 answers 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? Form data (for GET or POST) is usually encoded as application/x-www-form-urlencoded : this specifies + for spaces. URLs are encoded as RFC 1738

Why do some query strings work even if parameters are not URL-encoded?

北战南征 提交于 2019-11-26 14:39:56
问题 Here's an example: https://drive.google.com/viewerng/viewer?embedded=true&url=http://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_sample_main_body.pdf The url parameter, http://journals.plos.org/plosone/s/file?id=wjVg/PLOSOne_formatting_sample_main_body.pdf , is not encoded. It contains reserved characters, like the colon, slashes, and question mark. Why does this still work? And why bother encoding if it works without it? 回答1: The reserved characters of an URI are mostly used

URL: Username with @

女生的网名这么多〃 提交于 2019-11-26 12:16:05
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? You need to URL encode the @ as %40. Use %40 in your username instead of the @ symbol for the url encoding. It should pass it properly then. 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 where I get reserved characters in url authority or path parts. To solve general case of special characters: Just open