I get some wikipedia URL from freebase dump:
They both refer to the same page on wikipedia:
url 3: http://pt.wikipedia.org/wiki/Pedro_Miguel_de_Castro_Brandão_Costa
urllib.unquote works on url 1
url = 'Pedro_Miguel_de_Castro_Brand%25C3%25A3o_Costa'url = urllib.unquote(url)url = urllib.unquote(url)print url
but not work on url 2.
url = 'Pedro_Miguel_de_Castro_Brand%E3o_Costa'url = urllib.unquote(url)print url
Are there something wrong?
I need to send special characters (like polish characters) using form. I figured out i need to use urlencode and urldecode. How to use it when sending form?
The code of form is
<form id="form1" action="add.php" method="POST" accept-charset="utf-8"> Description: <input type=text name="title" maxlenght=150/><br/> Link: <input type=text name="link"/><br/><input type=submit value="Send"/>
I have a file with a list of user-agents which are encoded.Ex.
I want a shell script which can read this file and write to a new file with decoded strings.
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en
I have been trying to use this example to get it going but it is not working so far.
[echo -e "$(echo "%31+%32%0A%33+%34" | sed 'y/+/ /; s/%/\\x/g')"]#!/bin/bashfor f in *.log; do echo -e "$(cat $f | sed 'y/+/ /; s/%/\x/g')" > y.logdone
Any pointers will help.
[This may not be precisely a programming question, but it's a puzzle that may best be answered by programmers. I tried it first on the Pro Webmasters site, to overwhelming silence]
We have an email address verification process on our website. The site first generates an appropriate key as a string
It then encodes that key as a bunch of bytes
It then base64 encodes that bunch of bytes
Since this key is going to be given as a querystring value of a URL that is to be placed in an HTML email, we need to first URLEncode it then HTMLEncode the result, giving us (there's no effect of HTMLEncoding in the example case, but I can't be bothered to rework the example)
This is then embedded in HTML that is sent as part of an email, something like:
click <a href="http://myapp/verify?key=JiRkYWN%2ByoyIhIQ%3D%3D">here</a>. Or paste <b>http://myapp/verify?key=JiRkYWN%2ByoyIhIQ%3D%3D</b> into your browser.
When the receiving user clicks on the link, the site receives the request, extracts the value of the querystring 'key' parameter, base64 decodes it, decrypts it, and does the appropriate thing in terms of the site logic.
However on occasion we have users who report that their clicking is ineffective. One such user forwarded us the email he had been sent, and on inspection the HTML had been transformed into (to put it in terms of the example above)
click <a href="http://myapp/verify?key=JiRkYWN+yoyIhIQ%3D%3D">here</a>Or paste <b>http://myapp/verify?key=JiRkYWN+yoyIhIQ%3D%3D</b> into your browser.
That is, the %2B string - but none of the other percentage encoded strings - had been converted into a plus. (It's definitely leaving us with the right values - I've looked at the appropriate SMTP logs).
So I think that there are a couple of possibilities:
There's something I'm doing that's stupid, that I can't see, or
Some mail clients convert %2b strings to plus signs, perhaps to try to cope with the problem of people mistakenly URLEncoding plus signs
In case of 1 - what is it? In case of 2 - is there a standard, known way of dealing with this kind of scenario?
Many thanks for any help
I need to parse a URL string like this one:
I need to split the NSString up into the signle parts like
&avg_rating=4.82280613104. I've been doing this with
substringWithRange: but the values return in a random order, so that messes it up. Is there any class that allows easy parsing where you can basically convert it to NSDictionary to be able to read the value for a key (for example ValueForKey:
cid should return
241). Or is there just another easier way to parse it than using
NSMakeRange to get a substring?