urlencode

National characters in URI

妖精的绣舞 提交于 2020-01-24 16:17:35
问题 How should authors publish (by URI) resources with names containing non-ASCII (for example national) characters? Considering all the various parties (HTML code, browser sending request, browser saving file do disk, server receiving and processing request and server storing the file) all (possibly) using various encodings it seems nearly impossible to have it working consistently. Or at least I never managed. When it comes to web pages I’m already used to that and always replace national

National characters in URI

戏子无情 提交于 2020-01-24 16:15:21
问题 How should authors publish (by URI) resources with names containing non-ASCII (for example national) characters? Considering all the various parties (HTML code, browser sending request, browser saving file do disk, server receiving and processing request and server storing the file) all (possibly) using various encodings it seems nearly impossible to have it working consistently. Or at least I never managed. When it comes to web pages I’m already used to that and always replace national

URL encoding is getting failed for special character. #Android

ぐ巨炮叔叔 提交于 2020-01-24 11:44:11
问题 I'm working on a solution where need to encode string into utf-8 format, this string nothing but device name that I'm reading using BluetoothAdapter.getDefaultAdapter().name . For one of sampple I got a string like ABC-& and encoding this returned ABC-%EF%BC%86 instead of ABC-%26 . It was weird until further debugging which helped to identify that there is difference between & and & . Second one is some other character which is failing to encoded as expected. & and & both are different. For

Preserving + (Plus Sign) in URLEncoded Http Post request

末鹿安然 提交于 2020-01-24 11:12:09
问题 I have this function that I use for login requests. private login(params: LoginParams): Promise<any> { const loginHeaders: HttpHeaders = new HttpHeaders() .set('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8') .set('site', 'first'); const loginCredentials = new HttpParams() .set('j_username', params.username) .set('j_password', params.password); const requestUrl = this.appConfig.baseUrl + 'restoftheurl'; return this.http .post(requestUrl, loginCredentials.toString(),

URL的传递字符串问题小研究

允我心安 提交于 2020-01-24 08:03:17
前几天在调程序的时候遇到了比较郁闷的问题,我用URL从一个页面传递字符串到另一个页面的时,出现了个奇怪的问题,我要传递的字符串是“DK51+700中继站”;可是另一个页面接收到字符串却是:“DK51 700中继口”;加号变成了空格,“站”不能解析出来,变成了不能识别的符号“口”。 我上网查找了原因:URL中有些字符被转义,比如空格被编码成加号,于是传的参数明明是加号,获取的值却成了空格。 按照网上的建议,我们应该对要传递的参数进行编码处理。于是,我对传递的参数进行了处理,但是又衍生了一堆问题出来;我当时为了节约时间,就没有仔细研究,用了字符串中的Replace()方法在传送前代替了这两个字符,接收到了再代替回来。现在我来具体的展示下这个问题。 1.首先,我们先看下我的开始的问题(环境:VS2008):1.1. 新建一个网站,在其中添加一个页面,一个页面是Defaul.aspx,另一个页面Defaul2.aspx,在第一个页面中添加一个控件:HyperLink1;后台代码: 1.2. 在第二个页面中添加一个Label控件Label1;后台代码: 1.3. 结果显示:“DK51 700中继口”。 2.我当时的解决方法:用了字符串中的Replace()方法在传送前代替了这两个字符,接收到了再代替回来。 2.1第一个页面的后台代码:2.2.第二个页面中,后台代码: 2.3.结果是:

ASP.NET中的URL编码解码

时光总嘲笑我的痴心妄想 提交于 2020-01-24 07:23:06
今天项目需要向asp的客户url Post数据,可是url中文就是不行. 搞了一个下午是asp 和asp.net 的url编码不一样的事: 先看下面两个Url,他们传递的参数一样么? aaa.aspx?tag=.net%bc%bc%ca%f5 aaa.aspx?tag=.net%e6%8a%80%e6%9c%af 看起来好像是不一样,其实他们都是对".net技术"进行了UrlEncode,不过一个是GB2312的编码,一个是Utf-8的编码。 如下代码就可以获得上面的编码后效果: string tmp1 = System.Web.HttpUtility.UrlEncode(".net技术", System.Text.Encoding.GetEncoding("GB2312")); string tmp2 = System.Web.HttpUtility.UrlEncode(".net技术", System.Text.Encoding.UTF8); 我们实际的Web页面,可能会被其他程序调用。 比如:简体中文操作系统上的一个ASP页面,需要向一个ASP.net页面传递一个带中文的参数。 默认情况下,简体中文操作系统上, ASP 的 Server.UrlEncode 方法会把中文以GB2312的编码进行编码, 但是默认情况下,ASP.net的页面是采用的UTF-8编码。 这种情况下

Encoding curly braces in Jersey Client 2

ぃ、小莉子 提交于 2020-01-23 07:55:11
问题 We are using Jersey Client 2.21. I am noticing that when we put curly braces (aka curly brackets) as a param value, then it does not get properly encoded. Not only that, but anything inside the curly braces does not get encoded either. This is not true for regular brackets or other unsafe characters that I have tested with. Please see the example below. In this example I enter three params. A control param with just spaces. One with curly braces, and one with regular brackets. public static

Powershell - Invoke-WebRequest to a URL with literal '/' (%2F) in it

早过忘川 提交于 2020-01-22 14:32:31
问题 I have been trying to access a URL with a / character in it from powershell, using the following command (it's a query to a gitlab server to retrieve a project called "foo/bar" ): Invoke-WebRequest https://server.com/api/v3/projects/foo%2Fbar -Verbose Now, the odd thing is that using the PowerShell ISE or Visual Studio, the request is OK. When using PowerShell itself, the URL is automatically un-escaped and the request fails. E.g. In ISE/VS: $> Invoke-WebRequest https://server.com/api/v3

What does “the value of the cookie is automatically URLencoded when sending the cookie, and automatically decoded when received” mean?

让人想犯罪 __ 提交于 2020-01-22 03:12:25
问题 While learning the concept of Cookies in PHP, I come across the following statement from w3schools PHP Tutorial: The value of the cookie is automatically URLencoded when sending the cookie, and automatically decoded when received (to prevent URLencoding, use setrawcookie() instead) I did not get the meaning of this statement. I have following doubts regarding the above statement : From where the cookie is being sent to whom and at where the cookie is being received from whom? What actually

How to encode the plus (+) symbol in URL

◇◆丶佛笑我妖孽 提交于 2020-01-19 03:10:51
问题 The URL link below will open a new Google mail window. The problem I have is that Google replaces all the plus (+) sign in the email body with blank space. It looks like it only happens with the + sign. Any suggestions on how to remedy this? ( I am working the ASP.NET web page) https://mail.google.com/mail?view=cm&tf=0&to=someemail@somedomain.com&su=some subject&body=Hi there+Hello there (In the body email, "Hi there+Hello there" will show up as "Hi there Hello there") 回答1: The + character