urlencode

Unescape the chinese characters in url?

时光毁灭记忆、已成空白 提交于 2019-12-07 05:13:25
Sometimes, Chinese characters are escaped into forms like: %B9%F3%D6%DD%C3%A9%CC%A8 How do I convert these back to readable chinese characters in Python? You can use urllib2.unquote like this: >>> import urllib2 >>> print urllib2.unquote('%B9%F3%D6%DD%C3%A9%CC%A8').decode('gbk') 贵州茅台 dlask Try this, urllib.unquote(your_string).decode(your_encoding) 来源: https://stackoverflow.com/questions/13736452/unescape-the-chinese-characters-in-url

How do I properly encode a mailto link?

时光总嘲笑我的痴心妄想 提交于 2019-12-07 01:46:51
问题 I am generating some HTML and I want to generate an XSS- and database-content-safe mailto link. What is the proper encoding to use here? How's this? myLiteral.Text = string.Format( "mailto:{0}?Content-Type=text/html&Subject={1}&body={2}", HttpUtility.UrlEncode(email_address), HttpUtility.UrlEncode(subject), HttpUtility.UrlEncode(body_message)); Should I use UrlEncode here? HtmlEncode ? Do what I did, then HtmlEncode the entirety? I'm writing HTML of a URL, so I'm a little unclear... @Quentin,

Ampersands (&) in xlink:href attributes of SVG images?

我是研究僧i 提交于 2019-12-07 01:26:35
问题 I'm building an SVG document which contains various image tags. The xlink:href (source URL) attributes for the images contain query strings with ampersands. If I escape them as %26 or the ascii encoding ? they're not valid query strings and the server won't deliver the image. I can't escape them with CDATA because they're attributes (not nodes). I've tried creating an xlink:href node within the image tag but that get's ignored by the SVG parser. I want to use pure SVG (not SVG within HTML) so

Why Retrofit cannot encode properly query string with square brackets?

落爺英雄遲暮 提交于 2019-12-06 23:43:07
问题 I'm using Retrofit for my network layer in my Android app, but I have a problem with the URL encoding. I have to call an REST API like that: https://my_hostname.com/some_path?q=some_query&param[0]=value1&param[1]=value2&other_param=abcd as you can see the query string is composed by some different kind of parameters, so I decided to use the @QueryMap annotation in the Retrofit Interface with a Map<String, String> where q, param[1], param[0], other_param are String keys of the map What do I

how to get big5 urlencode in node.js?

筅森魡賤 提交于 2019-12-06 15:43:29
I want to use nodejs to encode the char '十'(\u5341) to big5 '%A4Q', but I don't know how to do it. I need help. More detail, bellow is a html file names test.html: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5"> <title>test</title> </head> <body> <form> <input name="a"/> <input type="submit"> </form> </body> </html> And open this file in Chrome, type '十' and click 'Submit', you can see the url in the address bar is ' http://localhost/test.html?a=%A4Q '. I just want to use nodejs to convert url same as Chrome(and other browsers). I tried to use

URL encode ASCII/UTF16 characters

假装没事ソ 提交于 2019-12-06 12:03:30
I'm trying to URL-encode some strings, however I have problems with methods provided by the .Net framework. For instance, I'm trying the encode strings that contain the 'â' character. According to w3schools for instance, I would expect this caracter to be encoded as '%E2' (and a PHP system I must call expects this too...). I tried using these methods: System.Web.HttpUtility.UrlEncode("â"); System.Web.HttpUtility.UrlPathEncode("â"); Uri.EscapeUriString("â"); Uri.EscapeDataString("â"); However, they all encode this character as: %C3%A2 I suppose this has something to do with the fact that

Using x-www-form-urlencoded Content-Type in WCF

自古美人都是妖i 提交于 2019-12-06 12:03:20
I'm writing a .NET client for Menalto Gallery 3 , which uses a RESTful JSON API (see API docs ). I decided to use WCF for my client and it looks like it could greatly simplify my work, were it not for the fact that there's one method that requires a Content-Type of application/x-www-form-urlencoded instead of application/json . I have seen various hacks to send urlencoded data from WCF, for example by using a Stream parameter which enables me to send arbitrary data, but still requires an IClientMessageInspector to set the Content-Type: internal class GalleryClientMessageInspector :

微信小程序发送红包功能。填坑记录

放肆的年华 提交于 2019-12-06 11:42:46
微信官方文档 1. 开通条件 (1)商户号已入驻 90 日 (2)商户号有连续 30 天正常交易 (3)只有 企业资质 的商户才有资格申请 2. 注意事项 (1) 目前小程序红包仅支持用户微信扫码打开小程序 (2) 小程序开通了 ‘社交红包类目’或者处于违规状态时,将无法开发小程序红包 (3)单日最高发放金额 一百万元 (可在商户平台设置) (4) 单日每个用户可领取红包个数 1-10 个 (可在商户平台设置) (5) 单日同一用户领取本商户红包金额 最高 一千元 (可在商户平台设置) (6) 防刷等级:防刷是指微信风控针对微信小号、僵尸号、机器号等的拦截,你可以通过更改防刷等级控制防刷的强度( 0 级为关闭, 1 到 3 逐级递增安全等级); (7)要选择好红包发放场景, 3. 需要提供的信息 (1) 需提供商户证书(详情见 4.4 ) (2)微信支付分配的商户号 (3) 公众账号 appid (4)商户名称(发送红包时,发送者名称) 4. 商户后台操作 4.1 开通小程序红包权限 在使用小程序红包之前,请前往开通小程序红包功能。操作路径:【登录微信支付商户平台 —— > 产品中心—— > 小程序红包—— > 开通】 4.2 首次开通时需要选择一个具体的小程序进行权限申请,如下图所示: 其他需要开通权限的小程序,可在页面自行设置。操作路径如下:【登录商户平台 —— > 产品中心—

URLEncode和URLDecode

感情迁移 提交于 2019-12-06 10:48:53
正文 System.Uri.EscapeDataString("Stack Overflow++"); System.Uri.EscapeUriString("example.com/Stack Overflow++?"); System.Net.WebUtility.UrlEncode("Stack Overflow++"); 参考 encodeURIComponent C#版本 来源: https://my.oschina.net/swustyc/blog/3137080

Emulate github service hooks wih curl

耗尽温柔 提交于 2019-12-06 10:26:26
问题 I have a service listening to github service hooks, to perform automatic deployment. Sometimes I need to trigger this manually (without github intervention). For that, I am emulating the POST request that github is sending (post-receive-URLs). My data ( my.json ) looks like this (a limited subset of what github is sending - I do not need more): { "action" : "deploy_from_scratch_with_bundle", "pusher" : { "email" : "my@email.com" }, "ref" : "refs/heads/master" } And I try to POST with curl: