url-encoding

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

ios URL(string: ) not working always

允我心安 提交于 2019-12-30 19:59:02
问题 let testurl = "http://akns- images.eonline.com/eol_images/Entire_Site/2018029/rs_1024x759- 180129200032-1024.lupita-nyongo-angela-bassett-black-panther- premiere.ct.012918.jpg?fit=inside|900:auto" if let url = URL(string: testurl){ print("valid") }else { print("invalid") } This prints as an invalid URL. But shows the image in web browser. I have seen lot of methods but it throws Apple warning to use stringByAddingPercentEncodingWithAllowedCharacters and this doesn't work always. I would

What other characters beside ampersand (&) should be encoded in HTML href/src attributes?

旧城冷巷雨未停 提交于 2019-12-30 09:18:10
问题 Is the ampersand the only character that should be encoded in an HTML attribute? It's well known that this won't pass validation: <a href="http://domain.com/search?q=whatever&lang=en"></a> Because the ampersand should be & . Here's a direct link to the validation fail. This guy lists a bunch of characters that should be encoded, but he's wrong. If you encode the first "/" in http:// the href won't work. In ASP.NET, is there a helper method already built to handle this? Stuff like Server

How to decode url-encoded string in javascript

一世执手 提交于 2019-12-30 08:30:16
问题 I use javascript / jquery to fill dom elements that contain umlauts: var text1 = "Unser platonisches Internetreich droht in die H%E4nde einer bewaffneten Miliz zu fallen." $("#quote1 span").html(unescape(text1)); How can I get rid of the url encoding e.g. "H%E4nde" and use "Hände" instead? I tried <meta charset="utf-8" /> <meta name="http-equiv" content="Content-type: text/html; charset=UTF-8"/> <script type="text/javascript" src="js/index.js" charset="utf-8"></script> But none of them seem

PHP sending encrypted data via the URL

久未见 提交于 2019-12-30 06:12:08
问题 I'm trying to send encrypted data over the url to another site (using file_get_contents("anotherUrl.php?hash=$encryptedString") . The problem is, sometimes, the encryption contains some special characters, like +, and this causes the decryption to fail. Here are my encryption / decryption methods: public function encrypt($string, $key) { return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key)))); } public function decrypt($encrypted, $key) {

How to use url encoding function between asp.net and asp

浪子不回头ぞ 提交于 2019-12-25 17:37:41
问题 I want to write the two functions that is used for asp.net and asp. I want to write two version. This function is used url encode and decode. Now, I got a new problem. This is how to work server.urlencode. So, how to implement this url encode function. I have url decode function for asp. I try to get url encode function for asp. So that, I can write url encode and decode in asp.net. Please, help me. This is url decode function. Function URLDecode(sConvert) Dim aSplit Dim sOutput Dim I If

URL Encoding issue in swift ios

为君一笑 提交于 2019-12-25 09:45:50
问题 I am getting url from my server response as: https://baseURL/The+Man+in+the+High+Castle+Official+Trailer+%E2%80%93+2+th.m3u8 and i am doing encoding as : videoURL = videoURL.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet())! but avplayer not able to play this particular url . seems like some issue in encoding URL 回答1: Your URL is already percent-encoded. If you encode it again, the percent parts will be encoded twice, giving an invalid URL. You

Google Translate API v2 - skip words and special character

醉酒当歌 提交于 2019-12-25 05:04:18
问题 I'm trying to use the Google API V2 with PHP I need to exclude some words so I'm wrapping them into <span class"notranslate">WORD</span> The problem is that my text contains some special chars so I'm using urlencode($input) The issue is that urlencode breaks the exclude word functionality ... What I'm doing wrong ? Example $url = "https://www.googleapis.com/language/translate/v2"; $params = array( 'key' => $helper->getConfigValue('google_api'), 'source' => $from, 'target' => $to, // NOTE for

Problems with passing Euro Sign as URL parameter

岁酱吖の 提交于 2019-12-25 02:44:31
问题 I am trying to pass the Euro ( € ) sign as url parameter in my spring jsp. What is the right way to do so ? I tried the following with no avail. Problem is the character is getting encoded properly but not getting decoded from my destination jsp. I am using <%@page contentType="text/html;charset=UTF-8" %> Here is the calling jsp: <script> ... // params contains the euro sign document.location='dest.jsp?p='+escape(params); In the dest.jsp <input type="hidden" id="par" value="${param.p}"> and

Problems with passing Euro Sign as URL parameter

不羁岁月 提交于 2019-12-25 02:44:12
问题 I am trying to pass the Euro ( € ) sign as url parameter in my spring jsp. What is the right way to do so ? I tried the following with no avail. Problem is the character is getting encoded properly but not getting decoded from my destination jsp. I am using <%@page contentType="text/html;charset=UTF-8" %> Here is the calling jsp: <script> ... // params contains the euro sign document.location='dest.jsp?p='+escape(params); In the dest.jsp <input type="hidden" id="par" value="${param.p}"> and