We are trying to decode base64 encoded strings from some scraped URLs. However the decoding works only partially and starts generating non-printable characters. For example,
Here is the encoded string
CiQ2MmE5NzI5NC01YTJhLTQzMTctOTU2Yi1lY2E3MjU3NzA2ZWEQyIgCGISAAiIDQ1BBKM609E8whIACOZhn42doAQAAQg10X3NyeGhsODZ2emxnSgJJRFIGQ2hyb21lWgxNb2JpbGUgUGhvbmViB0FuZHJvaWRqeGh0dHBzOi8vcmV2dHRtb2JpbGUuY29tL2NsaWNrLnBocD9rZXk9ZGEyZ3luNGc3bnZtanM4MDk0YWEmQ1BDPXtDUEN9JkNBTVBBSUdOX0lEPXtDQU1QQUlHTl9JRH0mQ1JFQVRJVkVfSUQ9e0NSRUFUSVZFX0lEfXIeCMaUMxD29gEYosk_IPb2ASgAMgYwLjAwNzBAAEgigAGIrpGwB4gB-o7B4wWSAQ8xMTguMTM2LjE1NC4yMjaaAQ8xMTguMTM2LjE1NC4yMjaiAQxKYWthcnRhIFJheWE=
the decoded output looks like this
i'$fpo%?$62a97294-5a2a-4317-956b-eca7257706ea"CPA(O09gghBt_srxhl86vzlgJIDRChromeZMobile PhonebAndroidjxhttps://revttmobile.com/click.php?key=da2gyn4g7nvmjs8094aa&CPC={CPC}&CAMPAIGN_ID={CAMPAIGN_ID}&CREATIVE_ID={CREATIVE_ID}r3=Jb+lh0Y 3bSB##i3bSB##j 'F&
So we are able to get partial data but not everything. Any ideas on why this is happening?
window.open(encodeURI('data:text/csv;charset=utf-8,name,color\njohn,#000000'));
In chrome, the previous line downloads a csv
with this content:
name,colorjohn,
It seems to ignore everything after the #
symbol.Do you have an idea why?
ps: On Safari it seems to work well, it opens a news tab with everything in it
If I encode a string like this:
var escapedString = originalString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)
it doesn't escape the slashes /
.
I've searched and found this Objective C code:
NSString *encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes( NULL, (CFStringRef)unencodedString, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8 );
Is there an easier way to encode an URL and if not, how do I write this in Swift?
I have a dict like this:
d = {'orderBy': 'XXXXX'}
When I call urlencode (), it transforms into:
orderBy = XXXXX
But I needed it to look like this:
orderBy = "XXXXX"
Does anyone know how I add these two quotes using urllib?Thank you!
I have a strange problem. I have in the past used a program I wrote myself to check if a new chapter has come out on a story at fanfiction.net and that program works fine even now (though its GUI leaves a lot to wish for).
However, when I am trying to make a new version I can't seem to load the webpage even though I'm using the exact same code (Copy Pasted). This is the code below. When sending in a URL like https://www.fanfiction.net/s/11012678/36 to the nextExists method it should return 'true'. My old program does, but this one doesn't even though it's the same code.
The only thing I can think of that might have any effect would be that I am using a new version of Eclipse which might cause it to mistake the Encoding, but I have tried checking all the common encoding types and nothing provides the HTML plaintext.
Does anyone have any idea what might be causing this? It's not a disaster if I can't get this right but I would like to know for the future in case I run into the same problem again.
import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URL;public class Util { private static final String BEFORE = "<button class=btn TYPE=BUTTON onClick=\"self.location='", AFTER = "'\">Next ></button>", SITE = "fanfiction.net"; public static String readSite(String path) throws Exception{ URL url = new URL(path); BufferedReader in = null; String line; try{ StringBuilder builder = new StringBuilder(); in = new BufferedReader(new InputStreamReader(url.openStream())); line = in.readLine(); if(line == null){ return null; } builder.append(line); while((line = in.readLine()) != null){ builder.append('\n' + line); } return builder.toString(); } finally{ if(in != null){ in.close(); } } } public static String updatePathToEnd(String path) throws Exception{ outer: while(nextExists(path)){ String data = readSite(path); if(path.contains(SITE)){ String link = path.substring(0, path.indexOf(SITE) + SITE.length()) + data.substring(data.indexOf(BEFORE) + BEFORE.length(), data.indexOf(AFTER)); if(readSite(link) != null) { path = link; continue outer; } } } return path; } public static boolean nextExists(String path) throws Exception{ String text = readSite(path); if(path.contains(SITE)){ return text==null ? false : text.contains(AFTER); } return false; }}
Acasă - Harta site-ului - Intimitate - Site-uri - Copyright © 2019 Cortex IT SRL : Contact : admin @ cortexit.co.uk
Please note that by viewing our site you agree to our use of cookies (see Intimitate for details). You will only see this message once.