url-encoding

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

我们两清 提交于 2019-11-28 07:47:38
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 variables followed by XY where x is a number and y is a lower case letter, but can not quite figure out how

URL encoding/decoding with Python

时光毁灭记忆、已成空白 提交于 2019-11-28 03:33:34
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, the \u and \x chars in there being some monetary prefixes like pound, yen, etc) 3) I call urllib.quote

What is %2C in a URL?

眉间皱痕 提交于 2019-11-28 02:35:30
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? Neverever Check out http://www.asciitable.com/ Look at the Hx , (Hex) column; 2C maps to , Any unusual encoding can be checked this way +----+-----+----+-----+----+-----+----+-----+ | Hx | Chr | Hx | Chr | Hx | Chr | Hx | Chr | +----+-----+----+-----+----+-----+----+-----+ | 00 | NUL | 20 | SPC | 40 | @ | 60 | ` | | 01 | SOH | 21 | ! | 41 | A | 61 | a | | 02 | STX | 22 | " | 42 | B | 62 | b | | 03 | ETX | 23 | # | 43 | C | 63 | c | | 04 | EOT

Python not able to open file with non-english characters in path

蓝咒 提交于 2019-11-27 21:33:29
I have a file with the following path : D:/bar/クレイジー・ヒッツ!/foo.abc I am parsing the path from a XML file and storing it in a variable called path in the form of file://localhost/D:/bar/クレイジー・ヒッツ!/foo.abc Then, the following operations are being done : path=path.strip() path=path[17:] #to remove the file://localhost/ part path=urllib.url2pathname(path) path=urllib.unquote(path) The error is : IOError: [Errno 2] No such file or directory: 'D:\\bar\\\xe3\x82\xaf\xe3\x83\xac\xe3\x82\xa4\xe3\x82\xb8\xe3\x83\xbc\xe3\x83\xbb\xe3\x83\x92\xe3\x83\x83\xe3\x83\x84\xef\xbc\x81\\foo.abc' Update 1 : I am

Why is the return value of String.addingPercentEncoding() optional?

六眼飞鱼酱① 提交于 2019-11-27 21:08:34
The signature of the String method for percent-escaping is: func addingPercentEncoding(withAllowedCharacters: CharacterSet) -> String? (This was stringByAddingPercentEncodingWithAllowedCharacters in Swift 2.) Why does this method return an optional? The documentation says that the method returns nil “if the transformation is not possible,” but it's unclear under what circumstances the escaping transformation could fail: Characters are escaped using UTF-8, which is a complete Unicode encoding. Any valid Unicode character can be encoded using UTF-8, and thus can be escaped. I thought perhaps the

Sharing a URL with a query string on Twitter

心不动则不痛 提交于 2019-11-27 17:13:57
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 shortening service, t.co. I've tried URL encoding this in various ways and cannot get anything to work. The

Detect the URI encoding automatically in Tomcat

主宰稳场 提交于 2019-11-27 12:56:54
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 Tomcat to encode the request the way I want? I might have to write a Filter that takes the request

iOS : How to do proper URL encoding?

▼魔方 西西 提交于 2019-11-27 11:34:48
问题 I'm unable to open a URL into UIWebView so I've seached & found that I need to encode URL, so I tried to encode it but, I've facing problem in URL encoding : My URL is http://somedomain.com/data/Témp%20Page%20-%20Open.html (It's not real URL). I'm concerned with %20 that I tried to replace using stringByReplacingOccuranceOfString:@"" withString:@"" , it give me the URL I wanted like http://somedomain.com/data/Témp Page - Open.html However its not opening in UIWebView but amazingly it opens in

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

我与影子孤独终老i 提交于 2019-11-27 09:22:59
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? unor The reserved characters of an URI are mostly used as delimiters -- it doesn’t mean that they may not be used, it only means that they have a special

How can I see how the browser percent-encoded my URL? (which is not visible on address bar)

前提是你 提交于 2019-11-27 08:27:23
问题 When I paste a url containing some reserved characters to the address bar of IE, FF, Chrome, I see that it displays it as it is but as far as I understand in uses percent-encoding in the background. How can I see in IE, FF and Chrome how the browser encoded the url? Is it possible? P.S: The reason I want to check this is I have a feeling my url is encoded differently in IE and FF and Chrome -so that it only works in IE. 回答1: Put the URL into an HTML page, ie, <a href="www.example.com?param