urlencode

urlencoding in Dart

佐手、 提交于 2019-11-27 21:08:33
Is there a function to do urlencoding in Dart? I am doing a AJAX call using XMLHttpRequest object and I need the url to be url encoded. I did a search on dartlang.org, but it didn't turn up any results. Lars Tackmann Update : There is now support for encode/decode URI in the Dart Uri class Dart's URI code is placed in a separate library called dart:uri (so it can be shared between dart:html and dart:io ). I looks like it currently does not include a urlencode function so your best alternative for now is probably to use this Dart implementation of JavaScript's encodeUriComponent . var uri =

WebClient以POST方式发送Web请求

[亡魂溺海] 提交于 2019-11-27 18:31:24
本例使用WebClient以POST方式发送Web请求并下载一个文件,难点是postData的构造,发送Web请求时有的网站要求可能要求Cookies前后一致。其中application/x-www-form-urlencoded会告诉服务器该参数是以param1=value1&param2=value2&param3=value3方式拼接的。 private bool postDataandDownloadFile(string fileName) { string url = "http://www.huiyaosoft.com/test.aspx"; StringBuilder postData = new StringBuilder(); postData.AppendFormat("{0}={1}&", "username", "admin"); postData.AppendFormat("{0}={1}&", "password", "123456"); postData.AppendFormat("{0}={1}&", "nickname", UrlEncode("辉耀")); try { if (wc == null) wc = new System.Net.WebClient(); wc.Headers.Add("Content-Type",

URL encoding a string in bash script

删除回忆录丶 提交于 2019-11-27 18:16:24
问题 I am writing a bash script in where I am trying to submit a post variable, however wget is treating it as multiple URLS I believe because it is not URLENCODED... here is my basic thought MESSAGE='I am trying to post this information' wget -O test.txt http://xxxxxxxxx.com/alert.php --post-data 'key=xxxx&message='$MESSAGE'' I am getting errors and the alert.php is not getting the post variable plus it pretty mush is saying can't resolve I can't resolve am can't resolve trying .. and so on. My

Encode the url including hyphen(-) and dot(.) in php

梦想的初衷 提交于 2019-11-27 17:49:21
问题 I need the encoded URL for processing in one of the API, but it requires the full encoded URL. For example, the URL from: http://test.site-raj.co/999999?lpp=1&px2=IjN has to become an encoded URL, like: http%3a%2f%test%site%2draj%2eco%2f999999%3flpp%3d1%26px2%3dIjN I need every symbol to be encoded, even the dot(.) and hyphen(-) like above. 回答1: Try this. Inside a function maybe if you are using it more than once... $str = 'http://test.site.co/999999?lpp=1&p---x2=IjN'; $str = urlencode($str);

URL Encode string for Href ASP.NET MVC / Razor

只愿长相守 提交于 2019-11-27 17:37:01
问题 I'm trying to build an Href using Razor The string is going to end up looking like this: https://www.notmysite/controller/action?order_ID=xxxxxxx&hashComparator=iFxp3%2BszAMaEB%2FnHCtRr9Ulhv0DumtyDumCik4gKypJqi0BdOGXXsr9QDkfefAsLaR1Xy%2BrX9VcuzP1pF2k6dL%2F92UxphzTKqNAZP2SSZGWtvyO5az%2F9JvDY%2Bsq5TBQo7%2FYAAMIU4QxiSX1SBKk8SUNECW3ZmKM%3D In my model I have the order id and the hash string As the route is not a part of my site I don't believe I can use the default methods like @Url.Action and

How to URL encode parameters in ASP .NET MVC

为君一笑 提交于 2019-11-27 16:07:05
I have the following code in my view: <%= Html.ActionLink( "View item", "Index", "Items", new { itemName = Model.ItemName }, null) %> I have a problem when the item name contains a sharp (#) or the percent symbol (%). When the item name is "name#with#sharp#" , the controller receives only the first part of the name until the first sharp (only receives "name" ). When the item name is "name%with%percent" I get an error: HTTP error 400 - Bad request. I not sure if this is a problem with the URL encoding, because it works with other conflictive chars such as: ; = + , ~ [blank] Do you know how

String won't url encode in iOS

天大地大妈咪最大 提交于 2019-11-27 14:48:47
I'm seriously having a brain fart here, but I can't figure out why this isn't encoding for the life of me. Been searching all over, and I can't even get the code samples to encode. Any ideas? NSString *searchString = @"waffl&es"; NSString *encodedSearchString = [searchString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; NSString *urlString = [NSString stringWithFormat:@"http://en.wikipedia.org/?search=%@", encodedSearchString]; NSURL *url = [NSURL URLWithString:urlString]; For future reference, this is what I found to work (i.e. encode everything properly) + (NSString*

On Android, make a POST request with URL Encoded Form data without using UrlEncodedFormEntity

怎甘沉沦 提交于 2019-11-27 12:53:46
I have a string that is already in the proper URLEncoded Form format and would like to send it through a POST request on Android to a PHP server. I know the method for sending URL encoded forms on Android uses the UrlEncodedFormEntity and I know how to use it . The problem with that is that the data comes into the function already URL encoded and joined by ampersands, so using UrlEncodedFormEntity would involve a lot of extra work to turn it into a List of NameValuePairs and I'd rather not. So, how do I make a proper POST request sending this string as the content body? I have already tried

How to encode the plus (+) symbol in URL

岁酱吖の 提交于 2019-11-27 12:33:13
The URL link below will open a new Google mail window. The problem I have is that Google replaces all the plus (+) sign in the email body with blank space. It looks like it only happens with the + sign. Any suggestions on how to remedy this? ( I am working the ASP.NET web page) https://mail.google.com/mail?view=cm&tf=0&to=someemail@somedomain.com&su=some subject&body=Hi there+Hello there (In the body email, "Hi there+Hello there" will show up as "Hi there Hello there") Darin Dimitrov The + character has a special meaning in a url => it means whitespace. If you want to use the + sign you need

Why is curl truncating this query string?

不想你离开。 提交于 2019-11-27 12:15:59
I'm sure the answer to this is going to be some painfully obvious character encoding issue... I'm using curl on the command line to test some endpoints in a python app. The endpoint takes url params of latitude and longitude. Nothing too special. I put in the command: curl -v -L http://localhost:5000/pulse/?lat=41.225&lon=-73.1 Server responds, with verbose curl output: * Connected to localhost (127.0.0.1) port 5000 (#0) > GET /pulse/?lat=41.225 HTTP/1.1 > User-Agent: curl/7.21.6 (i686-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3 > Host: localhost:5000 >