urlencode

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

一世执手 提交于 2020-01-02 06:00:04
问题 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

Allow Double URL Encoded Request Paths To Be Valid

非 Y 不嫁゛ 提交于 2020-01-02 02:28:07
问题 I have a standard ASP.Net WebForms application running on IIS 7.0 with an Integrated Managed Pipeline. Many of the images on our site have spaces in their files names (e.g. './baseball drawing.gif' ). When we place these images into our html pages we url encode the paths so that our html img tags look like this < img src='./baseball%20drawing.gif' /> Now, the problem comes in when certain search engines and webcrawlers try to index our site. When they scrape our pages they will html encode

should encodeURI ever be used?

主宰稳场 提交于 2020-01-02 01:38:13
问题 Is there any valid use for javascript's encodeURI function? As far as I can tell, when you are trying to make a HTTP request you should either have: a complete URI some fragment you want to put in a URI, which is either a unicode string or UTF-8 byte sequence In the first case, obviously nothing needs to be done to request it. Note: if you actually want to pass it as a parameter (e.g ?url=http...) then you actually have an instance of the second case that happens to look like a URI. In the

Some questions about URLEncoder and URLDecoder?

牧云@^-^@ 提交于 2020-01-01 19:01:58
问题 I have gone thru javadocs of URLEncoder and URLDecoder. Then got more inquisitive. Consider the server as tomcat.In any webapplication whenever we submit the form , server converts the forms fields into urlencoded fields and when we do request.getParamter("fieldName"). Server again decode it with URLDecoder. Is that correct? Does server do it or browser? Simlary when we type any url in address bar same stuff happens? If server or browser does that when we require to encode or decode the

mod_rewrite rule to enforce canonical percent-encoding

亡梦爱人 提交于 2020-01-01 14:23:06
问题 We have a PHP app with a dynamic URL scheme which requires characters to be percent-encoded, even "unreserved characters" like parentheses or aphostrophes which aren't actually required to be encoded. URLs which the app deems to be encoded the "wrong" way are canonicalized and then redirected to the "right" encoding. But Google and other user agents will canonicalize percent-encoding/decoding differently, meaning when Googlebot requests the page it will ask for the "wrong" URL, and when it

A potentially dangerous Request.Path value was detected from the client (?) with valid URL

蓝咒 提交于 2020-01-01 11:58:11
问题 I have an ASP.NET MVC 4 Web Application running on IIS 7.5 for a few weeks now and I noticed that just recently I have been getting quite a lot of the following errors: System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (?). at System.Web.HttpRequest.ValidateInputIfRequiredByConfig() at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context) I know that this exception is caused when the URL path contains

解决ASP.NET中的各种乱码问题

拈花ヽ惹草 提交于 2020-01-01 08:45:29
[转 http://www.cnblogs.com/fish-li/archive/2012/10/14/2723631.html ] 阅读目录 开始 页面显示乱码问题 AJAX提交的数据乱码问题 JavaScript中正确的URL编码方式 ASP.NET中正确的URL编码方式 正确的URL编码方式的总结 彻底解决encodeURIComponent()与GB2312乱码问题 Cookie乱码问题 下载文件名乱码问题 多语言数据的乱码问题 乱码问题的总结 经常发现有人被乱码困扰着,而我感觉比较幸运,很少为此烦恼过。 在这篇博客中,我将把我想到的一些与乱码有关的经验总结出来,供大家参考。 回到顶部 页面显示乱码问题 在一个网站中,有些页面会正常显示,然而,有些页面会显示成乱码。 如果发生这种情况,可以检查一下web.config和文件编码。 如果web.config是这样配置的: <globalization fileEncoding="utf-8" /> 而文件的编码不是UTF-8: 那么就会有乱码问题。 注意:反之是不是会出现乱码的。 1. 不设置fileEncoding,此时不会有乱码现象。 2. fileEncoding="gb2312",文件以utf-8编码,此时也不会有乱码现象。 因此,我建议最好让所有文件都以UTF-8编码保存,从而解决这类乱码问题。 回到顶部

解决ASP.NET中的各种乱码问题

扶醉桌前 提交于 2020-01-01 08:45:11
阅读目录 开始 页面显示乱码问题 AJAX提交的数据乱码问题 JavaScript中正确的URL编码方式 ASP.NET中正确的URL编码方式 正确的URL编码方式的总结 彻底解决encodeURIComponent()与GB2312乱码问题 Cookie乱码问题 下载文件名乱码问题 多语言数据的乱码问题 乱码问题的总结 经常发现有人被乱码困扰着,而我感觉比较幸运,很少为此烦恼过。 在这篇博客中,我将把我想到的一些与乱码有关的经验总结出来,供大家参考。 回到顶部 页面显示乱码问题 在一个网站中,有些页面会正常显示,然而,有些页面会显示成乱码。 如果发生这种情况,可以检查一下web.config和文件编码。 如果web.config是这样配置的: <globalization fileEncoding="utf-8" /> 而文件的编码不是UTF-8: 那么就会有乱码问题。 注意:反之是不是会出现乱码的。 1. 不设置fileEncoding,此时不会有乱码现象。 2. fileEncoding="gb2312",文件以utf-8编码,此时也不会有乱码现象。 因此,我建议最好让所有文件都以UTF-8编码保存,从而解决这类乱码问题。 回到顶部 AJAX提交的数据乱码问题 AJAX技术流行了这么多年了,我想现在没有几个网站不使用这种技术的。 然而,有些人在使用AJAX时,遇到了乱码问题。

How to “URL decode” a string in Emacs Lisp?

落爺英雄遲暮 提交于 2020-01-01 07:30:14
问题 I've got a string like "foo%20bar" and I want "foo bar" out of it. I know there's got to be a built-in function to decode a URL-encoded string (query string) in Emacs Lisp, but for the life of me I can't find it today, either in my lisp/ folder or with google. Anybody remember what it's called? 回答1: org-link-unescape does the job for very simple cases ... w3m-url-decode-string is better, but it isn't built in and the version I have locally isn't working with Emacs 23. 回答2: url-unhex-string

Percentage Encoding of special characters before sending it in the URL

喜欢而已 提交于 2020-01-01 02:40:09
问题 I need to pass special characters like #,! etc in URL to Facebook,Twitter and such social sites. For that I am replacing such characters with URL Escape Codes. return valToEncode.Replace("!", "%21").Replace("#", "%23") .Replace("$", "%24").Replace("&", "%26") .Replace("'", "%27").Replace("(", "%28") .Replace(")", "%29").Replace("*", "%2A"); It works for me, but I want to do it more efficiently.Is there any other way to escape such characters? I tried with Server.URLEncode() but Facebook doesn