urlencode

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

主宰稳场 提交于 2019-12-17 10:46:34
问题 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

What's the difference between EscapeUriString and EscapeDataString?

时光总嘲笑我的痴心妄想 提交于 2019-12-17 10:15:11
问题 If only deal with url encoding, I should use EscapeUriString? 回答1: Use EscapeDataString always (for more info about why, see Livven's answer below) Edit : removed dead link to how the two differ on encoding 回答2: I didn't find the existing answers satisfactory so I decided to dig a little deeper to settle this issue. Surprisingly, the answer is very simple: There is (almost*) no valid reason to ever use Uri.EscapeUriString . If you need to percent-encode a string, always use Uri

How do I replace all the spaces with %20 in C#?

前提是你 提交于 2019-12-17 04:27:28
问题 I want to make a string into a URL using C#. There must be something in the .NET framework that should help, right? 回答1: I believe you're looking for HttpServerUtility.UrlEncode. System.Web.HttpUtility.UrlEncode(string url) 回答2: Another way of doing this is using Uri.EscapeUriString(stringToEscape). 回答3: I found useful System.Web.HttpUtility.UrlPathEncode(string str); It replaces spaces with %20 and not with +. 回答4: To properly escape spaces as well as the rest of the special characters, use

Should I URL-encode POST data?

与世无争的帅哥 提交于 2019-12-17 03:47:21
问题 I'm POSTing data to an external API (using PHP, if it's relevant). Should I URL-encode the POST variables that I pass? Or do I only need to URL-encode GET data? Thanks! UPDATE: This is my PHP, in case it is relevant: $fields = array( 'mediaupload'=>$file_field, 'username'=>urlencode($_POST["username"]), 'password'=>urlencode($_POST["password"]), 'latitude'=>urlencode($_POST["latitude"]), 'longitude'=>urlencode($_POST["longitude"]), 'datetime'=>urlencode($_POST["datetime"]), 'category'=

URL Encoding using C#

萝らか妹 提交于 2019-12-16 19:50:53
问题 I have an application which sends a POST request to the VB forum software and logs someone in (without setting cookies or anything). Once the user is logged in I create a variable that creates a path on their local machine. c:\tempfolder\date\username The problem is that some usernames are throwing "Illegal chars" exception. For example if my username was mas|fenix it would throw an exception.. Path.Combine( _ Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData),

在PHP中解决网页URL编码问题

对着背影说爱祢 提交于 2019-12-14 19:07:02
在PHP中有urlencode()、urldecode()、rawurlencode()、rawurldecode()这些函数来解决网页URL编码解码问题。 理解urlencode: urlencode: 是指针对网页url中的中文字符的一种编码转化方式,最常见的就是Baidu、Google等搜索引擎中输入中文查询时候,生成经过 Encode过的网页URL。urlencode的方式一般有两种一种是传统的基于GB2312的Encode(Baidu、Yisou等使用),一种是 基于utf-8的Encode(Google,Yahoo等使用)。本文分别分析两种方式的Encode与Decode。 中文 -> GB2312的Encode -> %D6%D0%CE%C4 中文 -> utf-8的Encode -> %E4%B8%AD%E6%96%87 Html中的urlencode: 编码为GB2312的html文件中: http://www.php.com/中文.rar -> 浏览器自动转换为 -> http://www.php.com/%D6%D0%CE%C4.rar 注意:Firefox对GB2312的Encode的中文URL支持不好,因为它默认是utf-8编码发送URL的,但是ftp://协议可以,应该算是Firefox一个bug。 编码为utf-8的html文件中: http:/

Get string from Server.UrlEncode as uppercase

狂风中的少年 提交于 2019-12-14 04:16:41
问题 I want its output as uppercase. This is what I get on Server.UrlEncode("http://") : http%3a%2f%2f but I need: http%3A%2F%2F Is there built-in solution in C#? The url encoded shall serve as signature base string (input to signature algorithm) to create digest (hash). The hash will then be verified by other system (java,php,etc), so they need to recreate the hash by signature reconstruction first. 回答1: This will uppercase all escaped characters in your string. string url = "http://whatever.com

response.sendRedirect replacing + with space in encrypted URL when receiving in app2?

时光毁灭记忆、已成空白 提交于 2019-12-14 03:42:45
问题 On a tomcat, I have two webapplications i.e app1 and app2. I send URL from app1 in encrypted form (using below program) to app2 . I send the URL through response.sendRedirect(encryptedURL) .Then at app2 I get this encrypted URL. I see there are some extra characters like +,space( ) in this encrypted URL at app2. I want the exact same URL at app2. I am not getting why these extra characters getting inserted? Here is the URL at app1 after encryption Rc9mgB+18chPk6nk1+gzpws6dO5

API to allow user with a (+) signed in their username to log in

房东的猫 提交于 2019-12-14 00:07:20
问题 Currently right now, user with an email such as test+test@email.com are not getting through are API because of the (+) sign. When making a database call with such a user ID, it brings results. However, when making an api call such as this. api.hq.org/user?token=1234567&username=test+test@email.com it does not bring any results. I am trying to find a way to allow such users to return results. I know its an URL encoding but I am wondering if anyone has encounter this at one point? 回答1: The + is

Codeigniter: All Arabic routes are not working

元气小坏坏 提交于 2019-12-13 17:22:54
问题 [Update] Added to the config but still not working $config['permitted_uri_chars'] .= '%D8%A2%D8%A7%D8%A8%D9%BE%D8%AA%D8%AB%D8%AC%DA%86%D8%AD%D8%AE%D8%AF%D8%B0%D8%B1%D8%B2%D8%B3%D8%B4%D8%B5%D8%B6%D8%B7%D8%B8%D8%B9%D8%BA%D9%81%D9%82%DA%A9%DA%AF%D9%84%D9%85%D9%86%D9%88%D9%87%DB%8C%D9%8A%DB%B1%DB%B2%DB%B3%DB%B4%DB%B5%DB%B6%DB%B7%DB%B8%DB%B9%DB%B0'; $config['charset'] = 'UTF-8'; //by default I have updated Codeigniter from 2.1 to 2.2 then to 3. The issue I have is in the routes in Arabic