urlencode

URL escaping MFC strings

一笑奈何 提交于 2019-12-22 07:57:13
问题 How do you URL escape an MFC CString? 回答1: InternetCanonicalizeUrl() 回答2: I created a wrapper function for others who may come across this solution. Also requires linking to Wininet.lib and including wininet.h bool EscapeURL ( CString& url, DWORD options = ICU_DECODE | ICU_ENCODE_PERCENT ) { DWORD bytes = url.GetLength () + 1; LPTSTR escapedString = new TCHAR[bytes + 1]; escapedString[0] = 0; // First read will generate the correct byte count for the return string // bool result =

Is there a way to disable urlencoding of anchor attributes in lxml

匆匆过客 提交于 2019-12-22 07:38:11
问题 I am using lxml 2.2.8 and trying to transform some existing html files into django templates. the only problem that i am having is that lxml urlencodes the anchor name and href attributes. for example: <xsl:template match="a"> <!-- anchor attribute href is urlencoded but the title is escaped --> <a href="{{{{item.get_absolute_url}}}}" title="{{{{item.title}}}}"> <!-- name tag is urlencoded --> <xsl:attribute name="name">{{item.name}}</xsl:attribute> <!-- but other attributes are not --> <xsl

Is there a way to disable urlencoding of anchor attributes in lxml

吃可爱长大的小学妹 提交于 2019-12-22 07:38:02
问题 I am using lxml 2.2.8 and trying to transform some existing html files into django templates. the only problem that i am having is that lxml urlencodes the anchor name and href attributes. for example: <xsl:template match="a"> <!-- anchor attribute href is urlencoded but the title is escaped --> <a href="{{{{item.get_absolute_url}}}}" title="{{{{item.title}}}}"> <!-- name tag is urlencoded --> <xsl:attribute name="name">{{item.name}}</xsl:attribute> <!-- but other attributes are not --> <xsl

In the Yesod ecosystem, what is the best way to urlencode some Text?

孤者浪人 提交于 2019-12-22 05:48:56
问题 I'd like to url-encode some Text (e.g., replace each space with a %20, etc.). I found "HTTP" Network.HTTP.Base.urlEncode and could use that, but I'm wondering if there's something else that's normally used in the Yesod ecosystem. 回答1: Unfortunately, due to the complexity of URL escaping, the real answer is "it depends." There are slightly different rules for the percent encoding of path segments and query strings, for example. I don't know exactly what you're trying to encode, but I'd

In the Yesod ecosystem, what is the best way to urlencode some Text?

你离开我真会死。 提交于 2019-12-22 05:47:45
问题 I'd like to url-encode some Text (e.g., replace each space with a %20, etc.). I found "HTTP" Network.HTTP.Base.urlEncode and could use that, but I'm wondering if there's something else that's normally used in the Yesod ecosystem. 回答1: Unfortunately, due to the complexity of URL escaping, the real answer is "it depends." There are slightly different rules for the percent encoding of path segments and query strings, for example. I don't know exactly what you're trying to encode, but I'd

Are IRIs valid as HTML attribute values?

寵の児 提交于 2019-12-22 04:33:15
问题 Is it valid HTML to use IRIs containing non-ASCII characters as attribute values (e.g. for href attributes) instead of URIs? Are there any differences among the HTML flavors (HTML and XHTML, 4 and 5)? At least RFC 3986 seems to imply that it isn't. I realize that it would probably be safer (regarding older and IRI-unaware software) to use percent encoding, but I'm looking for a definitive answer with regards to the standard. So far, I've done some tests with the W3C validator, and unescaped

HttpUtility.ParseQueryString without decoding special characters

牧云@^-^@ 提交于 2019-12-22 03:44:27
问题 Uri uri = new Uri(redirectionUrl); NameValueCollection col = HttpUtility.ParseQueryString(uri.Query) uri.Query is already decoded - so is there any way I can prevent ParseQueryString decoding it again? Apart from that - is there another method to retrieve a name value collection from a Uri without modifying any components? 回答1: Encoding the uri.Query before passing it to ParseQueryString is the first thing that comes to my head. UPDATE Just checked the ParseQueryString method with Reflector:

.htaccess & and %26 both splitting $_GET

早过忘川 提交于 2019-12-22 01:02:48
问题 Below is my .htaccess file for this particular articles folder. My problem is that these urls both split the $_GET variable when received by the php script. /food-and-diet/articles/test-&-cake.html /food-and-diet/articles/test-%26-cake.html Both of these urls create this $_GET array: Array ( [article] => test- [-cake] => [folder] => none ) Options +FollowSymLinks RewriteEngine On RewriteBase /food-and-diet/ RewriteRule ^.+(/css/.+)$ $1 [L] RewriteRule ^.+(/js/.+)$ $1 [L] RewriteRule ^.+(

Java equivalent of Pythons urllib.urlencode(HashMap based UrlEncode)

醉酒当歌 提交于 2019-12-21 20:30:24
问题 From Whats the java equivalent of Python’s urllib.urlencode? Like >>> urllib.urlencode({'abc':'d f', 'def': '-!2'}) 'abc=d+f&def=-%212' Where I can pass a HashMap of key values and it encodes and gives me the url string .. Edit: I wanted to avoid this scenario String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8"); data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8"); of manually concatenating the strings with =

Transformer library that comes with Java converts spaces in file paths to %20

纵然是瞬间 提交于 2019-12-21 12:40:16
问题 Here is a test application that writes out XML Files. Why are the spaces in my path being converted to %20 ? public class XmlTest { public static void main(String[] args) { String filename = "C:\\New Folder\\test.xml"; try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer