urlencode

PHP: convert spaces in string into %20?

独自空忆成欢 提交于 2020-01-11 15:17:08
问题 How can I convert spaces in string into %20 ? Here is my attempt: $str = "What happens here?"; echo urlencode($str); The output is "What+happens+here%3F" , so the spaces are not represented as %20 . What am I doing wrong? 回答1: Use the rawurlencode function instead. 回答2: The plus sign is the historic encoding for a space character in URL parameters, as documented in the help for the urlencode() function. That same page contains the answer you need - use rawurlencode() instead to get RFC 3986

How to pass multiple values for a single URL parameter?

核能气质少年 提交于 2020-01-10 21:21:06
问题 Is it possible to pass multiple values for a single URL parameter without using your own separator? What I want to do is that the backend expects an input parameter urls to have one or more values. It can me set to a single or multiple URLs. What is a way to set the urls parameter so it can have multiple values? I can't use my own separator because it can be part of the value itself. Example: http://example.com/?urls=[value,value2...] The urls parameter be set to just http://google.com or it

php队列的实现思路和详细过程

你。 提交于 2020-01-10 13:49:51
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 一、队列使用场景:为什么需要队列 在web开发中,我们经常会遇到需要处理批量任务的时候,这些批量任务可能是用户提交的,也可能是当系统被某个事件触发时需要进行批量处理的,面对这样的 任务,如果是用户提交的批量任务,初级程序员只能让用户触发提交动作后,等待服务器处理完毕,并且将结果返回到浏览器,期间用户不能关掉浏览器窗口,如果 数据比较大,或者处理速度比较慢,那用户体验将会因此受到直接影响。但是当我们使用某讯或者某浪的邮箱时,点击群发邮件之后,只需等待很短的时间,浏览器 提示提交成功,正在发送之类的信息时,用户就可以关掉浏览器,稍后,收件地址栏里的邮箱将陆续收到该群发邮件,再比如群发定时邮件,以及当商城系统中有客 户下单,客户,客服,仓库等相关人员收到订单邮件信息。诸如此类,队列的应用范围是如此之广。 二 :普通工程师的解决方案和架构师的解决方案 方案1:建表存邮件,消息等,用定时程序取出发送。 方案2:抽象到更高一层,开发一套通用异步处理队列适用于任何复杂的业务逻辑 那么,作为架构师,使用队列的做法,将抽象层和业务层分离,可具有良好的扩展性和可维护性。相比较而言就高明了许多,下面就我们介绍一下自定义队列的实现思路和方法。 三 :队列总体设计 1:需要队列程序,提供加入队列接口和取队列接口等 2:需要存储队列

UrlEncoding issue for string with ß character

不问归期 提交于 2020-01-06 14:02:17
问题 I have a parameter which I must pass as part of a url. The parameter contains this character: ß When I encode this string, I am expecting this: %DF but instead i'm getting: %c3%9f Here is a line of C# which I have been using to test string test = HttpUtility.UrlEncode("ß"); 回答1: This is because the default implementation of UrlEncode is based on the UTF8 character encoding. Actually this is entirely within your control. For example, the following code: string sample = new string((char)0x0DF,

QueryString converting %E1 to %ufffd

若如初见. 提交于 2020-01-04 02:56:06
问题 I have a URL like the following http://mysite.com/default.aspx?q=%E1 Where %E1 is supposed to be á . When I call Request.QueryString from my C# page I receive http://mysite.com/default.aspx?q=%ufffd It does this for any accented character. %E1, %E3, %E9, %ED etc. all get passed as %ufffd . Normal encoded values ( %2D , %2E , %27 ) all get passed correctly. The config file already has the responseEncoding / requestEncoding in the globalization section set to UTF-8. How could I read the correct

Encoding issue service stack, quotes and angle bracket being stripped

ぐ巨炮叔叔 提交于 2020-01-03 17:56:06
问题 I have a service stack application, A test service receives a simple request, but I'm finding the value of the request once received isn't matching the original request. I send in: http://localhost/testapp/test?value=%22test%20data%22%20%3C12345%3E but the code outputs: test data" 12345> Note the missing first double quote and the missing left hand angle bracket. Any ideas why the application would be dropping the first " and the "<"? Is it part of some sort XSS protection? My code: public

Delphi 10.3.3 THTTPClient Post问题

久未见 提交于 2020-01-03 03:15:25
如果对于Post提交,需要对参数进行urlEncode处理的需要注意。 对于Post参数,可以用TString或者TStringStream两者。如果你采用的是用TStringStream,那么必须按照要求,自行urlEncode处理。这里没有问题。 但如果你是用的TString参数。那么请不要做urlEncode处理了。因为该组件调用TString处理时,己经帮你urlencode处理了 我们可以打开CreateFormFromStings这个函数, 看这里,如果你urlencode处理过。这里他又帮你处理了一下。那么有可能发生错误。 在这里,建议统一使用使用TStringStream进行post,对于参数该怎么处理就怎么处理。 来源: https://www.cnblogs.com/wuxi15/p/12142986.html

AppleScript: encoding arbitrary query-string values in URLs passed to Firefox

怎甘沉沦 提交于 2020-01-02 10:35:34
问题 I use firefox for a long time as my only browser on Pc or Mac. In a few words my problem: I want to create a service on mac with automator and Applescript for quite instant translation using translate.google.com. What works great with Safari or Chrome (below the 4 or 5 lines of script) On run {input, parameters} Tell application "Safari" activate try Open location "https://translate.google.com/#auto/en/" & (the clipboard) end try end tell end run The same thing (script) does not work at all

PHP $_GET var with urlencode and “&” bug

穿精又带淫゛_ 提交于 2020-01-02 07:18:09
问题 In my code, I create a link like this: $link = 'http://www.mydomain.com/'.urlencode($str).'/1'; I use url-rewriting and the rule in my htaccess file looks like this: rewriteRule ^(.+)/(.*)$ index.php?var1=$1&var2=$2 [NC,L] This code is working fine for almost every strings. But sometimes, the string to encode contains "&". The urlencode function encodes it corectly, but when I read the $_GET array in php, it looks like this (with $str = 'substring1&substring2'): 'var1' => 'substring1'

Re-encode url from utf-8 encoded to iso-8859-1 encoded

大憨熊 提交于 2020-01-02 06:01:11
问题 I have file:// links with non-english characters which are UrlEncoded in UTF-8. For these links to work in a browser I have to re-encode them. file://development/H%C3%A5ndplukket.doc becomes file://development/H%e5ndplukket.doc I have the following code which works: public string ReEncodeUrl(string url) { Encoding enc = Encoding.GetEncoding("iso-8859-1"); string[] parts = url.Split('/'); for (int i = 1; i < parts.Length; i++) { parts[i] = HttpUtility.UrlDecode(parts[i]); // Decode to string