urlencode

Are non-english characters 100% supported in codeigniter urls by default?

血红的双手。 提交于 2019-12-06 09:23:33
问题 I want to be sure if this behavior is 100% supported in CodeIgniter. What doubts me is that in config.php the permitted_uri_chars is as followed: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; It says that only English chars are allowed. BUT consider the results of following urls: http://localhost/codeigniter/index.php/controller/method/hell0-there+++ Result: The URI you submitted has disallowed characters. http://localhost/codeigniter/index.php/controller/method/hello-سلام Result: No

URLEncode

不问归期 提交于 2019-12-06 08:48:15
为什么请求时,需要使用URLEncode做encode转码操作? 发现现在几乎所有的网站都对url中的汉字和特殊的字符,进行了urlencode操作, 也就是: http://hi.baidu.com/%BE%B2%D0%C4%C0%CF%C8%CB/creat/blog/ 这个样子,中间%形式的,肯定就是我的登录用户名称了吧。 为什么对这些字符进行了u的编码形式,是为了字符编码(gbk、utf8)还是为了不出现特殊的字符在url中?都知道要转,但是转了的真正好处呢。查看了网上的很多资料,也没有找到更加准确的说法。 url转义其实也只是为了符合url的规范而已。因为在标准的url规范中中文和很多的字符是不允许出现在url中的。 那哪些字符是需要转化的呢? ASCII 的控制字符 这些字符都是不可打印的,自然需要进行转化。 一些非ASCII字符 这些字符自然是非法的字符范围。转化也是理所当然的了。 一些保留字符 很明显最常见的就是“&”了,这个如果出现在url中了,那你认为是url中的一个字符呢,还是特殊的参数分割用的呢? 就是一些不安全的字符了。 例如:空格。为了防止引起歧义,需要被转化为“+”。 明白了这些,也就知道了为什么需要转化了,而转化的规则也是很简单的。 按照每个字符对应的字符编码,不是符合我们范围的,统统的转化为%的形式也就是了。自然也是16进制的形式。 和字符编码无关

URL encode in Erlang and Cyrillic

若如初见. 提交于 2019-12-06 08:15:42
问题 I'm using standard httpc client in erlang, for sending/receiving request to some service. Sometimes I have a Cyrillic path in my URL. How can I URL-encode Cyrillic URLs? Thank you. 回答1: ~/erl$erl Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false] Eshell V5.8.5 (abort with ^G) 1> Encoded = edoc_lib:escape_uri("абвгдеё"). "%c0%b0%c0%b1%c0%b2%c0%b3%c0%b4%c0%b5%c1%91" 2> http_uri:decode(Encoded). [192,176,192,177,192,178,192,179,192,180,192

I need to URL-encode a string in AppleScript

六月ゝ 毕业季﹏ 提交于 2019-12-06 05:19:10
问题 My script searches a website for songs, but when there are spaces it doesn't search, you have to add underscores. I was wondering if there was a way to replace my spaces with underscores. Could you please use my current code below to show me how to do it? set search to text returned of (display dialog "Enter song you wish to find" default answer "" buttons {"Search", "Cancel"} default button 1) open location "http://www.mp3juices.com/search/" & search end 回答1: Try the following: set search to

How can I send a GET request containing a colon, to an ASP.NET MVC2 controller?

一个人想着一个人 提交于 2019-12-06 05:12:17
问题 This works fine: GET /mvc/Movies/TitleIncludes/Lara%20Croft When I submit a request that contains a colon, like this: GET /mvc/Movies/TitleIncludes/Lara%20Croft:%20Tomb ...it generates a 400 error. The error says ASP.NET detected invalid characters in the URL. If I try url-escaping, the request looks like this: GET /mvc/Movies/TitleIncludes/Lara%20Croft%3A%20Tomb ...and this also gives me a 400 error. If I replace the colon with a | : GET /mvc/Movies/TitleIncludes/Lara%20Croft|%20Tomb ..that

is `addingPercentEncoding` broken in Xcode 9?

為{幸葍}努か 提交于 2019-12-06 05:02:39
问题 in Swift 3.x with Xcode 9 beta 2, using addingPercentEncoding gives unexpected results. CharacterSet.urlPathAllowed always contains ":", so by definition of addingPercentEncoding , it should never escape it. Yet, using this code: // always true print(CharacterSet.urlPathAllowed.contains(":")) let myString = "info:hello world" let escapedString = myString.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)! print(escapedString) I get those results: cases where I get an undesirable

在PHP下载文件名中解决乱码

独自空忆成欢 提交于 2019-12-06 03:38:48
通过把Content-Type设置为application/octet-stream, 可以把动态生成的内容当作文件来下载,相信这个大家都会。 那么用Content-Disposition设置下载的文件名, 这个也有不少人知道吧。 基本上,下载程序都是这么写的: <?php $filename = "document.txt"; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename); print "Hello!"; ?> [/cdoe] 这样用浏览器打开之后,就可以下载document.txt。 但是,如果$filename是UTF-8编码的,有些浏览器就无法正常处理了。 比如把上面那个程序稍稍改一下: [code] <?php $filename = "中文 文件名.txt"; header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename=' . $filename); print "Hello!"; ?> [/cdoe] 把程序保存成UTF-8编码再访问

How to prevent IIS not to change backslashes with forward slashes

扶醉桌前 提交于 2019-12-06 02:38:18
I am using WebAPI2 and I have a route "Products/{Id}/details". When Id contains \ , IIS changes it to / . For example pr\p is changed to pr/p and it "spoils" the uri. I want to know how to prevent changing ** to **/ , or are there any other workarounds? Thanks in advance for your help. This looks useful: <rule name="KeepBackslashes" stopProcessing="true"> <match url="(.*)" /> <action type="Rewrite" url="http://HOST:PORT/{UrlDecode:{C:1}}" logRewrittenUrl="true" /> <conditions> <add input="{UNENCODED_URL}" pattern="/(.*?)($|\?)" /> </conditions> </rule> 来源: https://stackoverflow.com/questions

urllib,urllib2在python2与python3中的区别(转载)

懵懂的女人 提交于 2019-12-06 02:28:02
什么是Urllib库 Urllib是Python提供的一个用于操作URL的模块,我们爬取网页的时候,经常需要用到这个库。 升级合并后,模块中的包的位置变化的地方较多。在此,列举一些常见的位置变动,方便之前用Python2.x的朋友在使用Python3.x的时候可以快速掌握。 常见的变化有: 在Pytho2.x中使用import urllib2-------对应的,在Python3.x中会使用import urllib.request,urllib.error。 在Pytho2.x中使用import urllib-------对应的,在Python3.x中会使用import urllib.request,urllib.error,urllib.parse。 在Pytho2.x中使用import urlparse-------对应的,在Python3.x中会使用import urllib.parse。 在Pytho2.x中使用import urlopen-------对应的,在Python3.x中会使用import urllib.request.urlopen。 在Pytho2.x中使用import urlencode-------对应的,在Python3.x中会使用import urllib.parse.urlencode。 在Pytho2.x中使用import urllib

S3 PUT doesn't work with pre-signed URL in javascript

≡放荡痞女 提交于 2019-12-06 01:52:28
问题 I have generated a pre-signed S3 URL in java for HTTP PUT method. A slightly modified version of the URL: https://s3.amazonaws.com/somebucket/pre-signed-url-key-2?AWSAccessKeyId=BKIAIQ6H5Z7BG6KZ2ZUA&Expires=1425617244&Signature=GWcRM5ZIrAKnMJBsxyfm%2F9fyuBk%3D I know that it is a valid pre-signed url since I can use it with curl to upload a file curl -v --upload-file somefile.txt "https://s3.amazonaws.com/somebucket/pre-signed-url-key-2?AWSAccessKeyId=BKIAIQ6H5Z7BG6KZ2ZUA&Expires=1425617244