urlencode

Explanation requested for fixedEncodeURIComponent

狂风中的少年 提交于 2019-12-11 18:38:16
问题 I'm wondering if anyone can explain this function to me? I've tested it and it works like a dream but I don't understand how! It's from the MDN reference here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent function fixedEncodeURIComponent (str) { return encodeURIComponent(str).replace(/[!'()]/g, escape).replace(/\*/g, "%2A"); } I understand replace as the match followed by the replacement, what I am struggling with is the escape reference

urlencode doesn't work in PHP (localhost)

∥☆過路亽.° 提交于 2019-12-11 17:53:44
问题 So i worked in a project that i need to encode my URL , for example in my URL i have : $url = 'http://www.test.com/?sms=+212&text=bla bla' urlencode($url); $url = urlencode($url); Also i tried rawurlencode($url); and i got the same Url without changes !! so please if someone has any idea i will be so appreciative :) 回答1: $url = "http://www.test.com/?sms=+212&text=bla bla"; echo $url = urlencode($url); 回答2: urlencode returns a new encoded url, doesn't change the $url passing to it. try this

php urlencode encodes wrong?

吃可爱长大的小学妹 提交于 2019-12-11 11:53:03
问题 If I try to encode the url http://herthabsc.de/index.php?id=3631&tx_ttnews[tt_news]=13144&cHash=9ef2e9ee006fb16188ebf764232a0ba9 with urlencode() or http_build_query() it gives me the result http%3A%2F%2Fherthabsc.de%2Findex.php%3Fid%3D3631%26%23038%3Btx_ttnews%5Btt_news%5D%3D13144%26%23038%3BcHash%3D9ef2e9ee006fb16188ebf764232a0ba9 But that's not what it should be. Is there a known bug? Or problems in use with wordpress? 回答1: You've double encoded the URL. Running urldecode() on your output

Encode URL with nested dictionaries

泄露秘密 提交于 2019-12-11 08:06:30
问题 I am using an API that doesn't accept JSON in the requests' bodies. It uses x-www-form-urlencoded . Thus, if I have to send this dict : { 'a': 1, 'b': 2, 'c': { 'k': 3, 'v': 4, 'l': { 'p': 5, 'q': 6, }, }, } It have to be encoded like this: a=1 b=2 c[k]=3 c[v]=4 c[l][p]=5 c[l][q]=6 However, urllib.parse.urlencode won't parse the dict this way. Instead it's going to encode c content literally and put within it ( c={encodeddict} ). I tried to implement some encoder like this by myself, but I

Trying to decode % character in a parameter value JMeter fails with IllegalArgumentException: URLDecoder: Illegal hex characters in escape(%) pattern

我的梦境 提交于 2019-12-11 07:54:54
问题 Using Apache JMeter 2.7, the message body (JSON) for my POST request contains a password field which is in the form asdf%xy3dsfsfsf . JMeter is trying to interpret %xy as percent encoded character and throwing this exception. Uncaught Exception java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape(%) pattern - For input string: "xy". See log file for details. I cannot escape the character using backslash asdf\%xy3dsfsfsf since it would get to the webservice as the

URL percent encoding is not working

末鹿安然 提交于 2019-12-11 07:07:50
问题 I'm trying to do a somewhat simple thing with no luck - I want to display Hebrew/Arabic characters in my URL. For example: I want the URL to display a file named: aאm.php So I've percent encoded the middle UTF8 characters and the result is: a%D7%90m.php . I've uploaded a%D7%90m.php to my server (Apache) and tried to request the pages www.example.com/a%D7%90m.php & www.example.com/aאm.php but my server responded: The requested URL /a%D7%90m.php was not found on this server. So I tried to

data being stripped off after ampersand in URL even when using urlencode

隐身守侯 提交于 2019-12-11 06:55:39
问题 I am passing ampersands in a URL which go into a get request e.g. http://www.soundshelter.co.uk/label/Hit & Run I have tried to urlencode the & so that it is a valid URL http://www.soundshelter.co.uk/label/Hit%20%26%20Run but the & Run section of the URL is being cut off in the get request. I'm thinking this might have something to do with my mod_rewrite RewriteRule ^label/([^/]*)$ /index.php?label=$1 [NC] the get request is $label = $_GET['label']; Any ideas? Cheers 回答1: From the

How do I convert a path in ASCII hex code, to its equivalent ASCII letters?

情到浓时终转凉″ 提交于 2019-12-11 04:43:25
问题 I am trying to use the following path in Python: /home/user/Music/library/1-02%2520Maralito.mp3 The file name is: "1-02 Maralito.mp3" So the space is being converted to the code %2520 , which I do not know what represents. I am using Rhythmbox API on Ubuntu, and I can't convert the value back in Python. Any suggestions? 回答1: This string has been URL-encoded twice. The %25 represents a % character. The %20 resulting from decoding the %25 represents a space. urllib.parse.unquote (just urllib

How to encode or decode URL in objective-c

蹲街弑〆低调 提交于 2019-12-11 03:54:25
问题 Is there something like +(NSString *) URLencode: (NSString *) someString +(NSString *) URLdecode: (NSString *) someString If so, how to implement it? Note to downvoters. This is NOT a simple question. I need something that can comprehensively do this. For example: NSString * test = @"汉字马拉松是"; NSString * encoded = [test stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; PO(encoded); PO(test); Will yield the following: 2012-06-04 16:04:22.709 BadgerNew[2266:17003] <0xcd890

Spring security and special characters

邮差的信 提交于 2019-12-11 03:33:49
问题 I need to log in with j_spring_security_check using special characters in the username and/or in the password via url http://localhost:8080/appname/j_spring_security_check?j_username=username&j_password=üüü isn't working and http://localhost:8080/appname/j_spring_security_check?j_username=username&j_password=%c3%bc%c3%bc%c3%bc (with "üüü" urlencoded) isn't working either Any suggestion? Let me know if you need to see any other configuration. Thanks 回答1: The Java Servlet standard is lamentably