Search Results

Search found 52 results on 3 pages for 'urldecode'.

Page 1/3 | 1 2 3  | Next Page >

  • urldecode in ruby ?

    - by wefwgeweg
    how do i transform www.bestbuy.com/site/Electronics\Audio\abcat0200000.c=3fid=3dabcat0200000 into its original format ? www.bestbuy.com/site/Electronics/Audio/abcat0200000.c?id=abcat0200000 urldecode ?

    Read the article

  • Does UrlDecode handle plus (+) correctly?

    - by harpo
    According to RFC 2396, The plus "+", dollar "$", and comma "," characters have been added to those in the "reserved" set, since they are treated as reserved within the query component. Indeed, search this site for "plus + comma , dollar $", and you get http://stackoverflow.com/search?q=plus+%2B+comma+,+dollar+$ Plus is only encoded (by the application) when it's not being used as a delimiter. But as others have observed, .NET's UrlDecode function converts plus to space. Where is this behavior specified?

    Read the article

  • QueryString malformed after URLDecode

    - by pdavis
    I'm trying to pass in a Base64 string into a C#.Net web application via the QueryString. When the string arrives the "+" (plus) sign is being replaced by a space. It appears that the automatic URLDecode process is doing this. I have no control over what is being passed via the QueryString. Is there any way to handle this server side? Example: http://localhost:3399/Base64.aspx?VLTrap=VkxUcmFwIHNldCB0byAiRkRTQT8+PE0iIHBsdXMgb3IgbWludXMgNSBwZXJjZW50Lg== Produces: VkxUcmFwIHNldCB0byAiRkRTQT8 PE0iIHBsdXMgb3IgbWludXMgNSBwZXJjZW50Lg== People have suggested URLEncoding the querystring: System.Web.HttpUtility.UrlEncode(yourString) I can't do that as I have no control over the calling routine (which is working fine with other languages). There was also the suggestion of replacing spaces with a plus sign: Request.QueryString["VLTrap"].Replace(" ", "+"); I had though of this but my concern with it, and I should have mentioned this to start, is that I don't know what other characters might be malformed in addition to the plus sign. My main goal is to intercept the QueryString before it is run through the decoder. To this end I tried looking at Request.QueryString.toString() but this contained the same malformed information. Is there any way to look at the raw QueryString before it is URLDecoded? After further testing it appears that .Net expects everything coming in from the QuerString to be URL encoded but the browser does not automatically URL encode GET requests.

    Read the article

  • jQuery urlencode/decode patch help

    - by jeerose
    Hi Gang, I'm using this jQuery urlencode and urldecode plugin - very simple and easy to use but it doesn't, in its original form, remove + from the string. The one comment on the home page suggests a patch but I don't know how to implement it. Can anyone help me out? The Page: http://www.digitalbart.com/jquery-and-urlencode/ //URL Encode/Decode $.extend({URLEncode:function(c){var o='';var x=0;c=c.toString(); var r=/(^[a-zA-Z0-9_.]*)/; while(x<c.length){var m=r.exec(c.substr(x)); if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length; }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16); o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;}, URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/; while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){ b=parseInt(m[1].substr(1),16); t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;} }); The proposed Patch: function dummy_url_decode(url) { // fixed -- + char decodes to space char var o = url; var binVal, t, b; var r = /(%[^%]{2}|\+)/; while ((m = r.exec(o)) != null && m.length > 1 && m[1] != '') { if (m[1] == '+') { t = ' '; } else { b = parseInt(m[1].substr(1), 16); t = String.fromCharCode(b); } o = o.replace(m[1], t); } return o; } Thanks!

    Read the article

  • php $_REQUEST data is only half-decoded

    - by hackmaster.a
    I am retrieving a url via querystring. I need to pass it again to the next page. When I retrieve it the first time, using $_REQUEST['url'], only the slashes are decoded, e.g: http://example.com/search~S10?/Xllamas&searchscope=10&SORT=D/Xllamas&searchscope=10&SORT=D&SUBKEY=llamas/51%2C64%2C64%2CB/browse The php docs page for urldecode advises against decoding request data, and says that it will already be decoded. I need it either completely decoded, so I can encode it again without double-encoding some parts, or not decoded at all. I'm not sure why my experience of this data is incongruous with the php docs. Appreciate any help or pointers to same!!

    Read the article

  • java inserting special characters with preparedstatement fails

    - by phill
    I am using an HTML form which sends <input type=hidden name=longdesc value='SMARTNET%^" 8X5XNBD'> this is done by the following javascript code: function masinsert(id) { var currentTime=new Date(); var button = document.getElementById("m"+id); button.onclick=""; button.value="Inserting"; var itemdescription = document.getElementById("itemdescription"+id).value; function handleHttpResponse() { if (http.readyState == 4) { button.value="Item Added"; } } var http = getHTTPObject(); // We create the HTTP Object var tempUrl = "\AInsert"; tempUrl += "itemdescription="+itemdescription+"&"+"itemshortdescription="+itemdescription.substring(0,37)+; alert(tempUrl); http.open("GET", tempUrl, true); http.onreadystatechange = handleHttpResponse; http.send(null); } to a java servlet. AInsert.java in the AInsert.java file, I do a String itemdescription = request.getParameter("longdesc"); which then sends the value to a preparedstatement to run an insert query. In the query, there are sometimes special characters which throw it off. For example, when I run the following insert into itemdescription (longdesc) values ('SMARTNET%^" 8X5XNBD') here is the actual snippet: PreparedStatement ps = conn.prepareStatement("INSERT INTO itemdescription (longdesc) values(?)"); ps.setString(1, itemdescription); ps.executeUpdate(); It will produce an error saying : Cannot insert the value NULL into column 'LongDesc', table 'App.dbo.itemdescription'; column does not allow nulls. Insert fails I have tried urlencode/urldecode String encodedString = URLEncoder.encode(longdesc, "UTF-8"); String decitemdescription = URLDecoder.decode(itemdescription, "UTF-8"); and i've also tried these functions //BEGIN URL Encoder final static String[] hex = { "%00", "%01", "%02", "%03", "%04", "%05", "%06", "%07", "%08", "%09", "%0a", "%0b", "%0c", "%0d", "%0e", "%0f", "%10", "%11", "%12", "%13", "%14", "%15", "%16", "%17", "%18", "%19", "%1a", "%1b", "%1c", "%1d", "%1e", "%1f", "%20", "%21", "%22", "%23", "%24", "%25", "%26", "%27", "%28", "%29", "%2a", "%2b", "%2c", "%2d", "%2e", "%2f", "%30", "%31", "%32", "%33", "%34", "%35", "%36", "%37", "%38", "%39", "%3a", "%3b", "%3c", "%3d", "%3e", "%3f", "%40", "%41", "%42", "%43", "%44", "%45", "%46", "%47", "%48", "%49", "%4a", "%4b", "%4c", "%4d", "%4e", "%4f", "%50", "%51", "%52", "%53", "%54", "%55", "%56", "%57", "%58", "%59", "%5a", "%5b", "%5c", "%5d", "%5e", "%5f", "%60", "%61", "%62", "%63", "%64", "%65", "%66", "%67", "%68", "%69", "%6a", "%6b", "%6c", "%6d", "%6e", "%6f", "%70", "%71", "%72", "%73", "%74", "%75", "%76", "%77", "%78", "%79", "%7a", "%7b", "%7c", "%7d", "%7e", "%7f", "%80", "%81", "%82", "%83", "%84", "%85", "%86", "%87", "%88", "%89", "%8a", "%8b", "%8c", "%8d", "%8e", "%8f", "%90", "%91", "%92", "%93", "%94", "%95", "%96", "%97", "%98", "%99", "%9a", "%9b", "%9c", "%9d", "%9e", "%9f", "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7", "%a8", "%a9", "%aa", "%ab", "%ac", "%ad", "%ae", "%af", "%b0", "%b1", "%b2", "%b3", "%b4", "%b5", "%b6", "%b7", "%b8", "%b9", "%ba", "%bb", "%bc", "%bd", "%be", "%bf", "%c0", "%c1", "%c2", "%c3", "%c4", "%c5", "%c6", "%c7", "%c8", "%c9", "%ca", "%cb", "%cc", "%cd", "%ce", "%cf", "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", "%d8", "%d9", "%da", "%db", "%dc", "%dd", "%de", "%df", "%e0", "%e1", "%e2", "%e3", "%e4", "%e5", "%e6", "%e7", "%e8", "%e9", "%ea", "%eb", "%ec", "%ed", "%ee", "%ef", "%f0", "%f1", "%f2", "%f3", "%f4", "%f5", "%f6", "%f7", "%f8", "%f9", "%fa", "%fb", "%fc", "%fd", "%fe", "%ff" }; /** * Encode a string to the "x-www-form-urlencoded" form, enhanced * with the UTF-8-in-URL proposal. This is what happens: * * <ul> * <li><p>The ASCII characters 'a' through 'z', 'A' through 'Z', * and '0' through '9' remain the same. * * <li><p>The unreserved characters - _ . ! ~ * ' ( ) remain the same. * * <li><p>The space character ' ' is converted into a plus sign '+'. * * <li><p>All other ASCII characters are converted into the * 3-character string "%xy", where xy is * the two-digit hexadecimal representation of the character * code * * <li><p>All non-ASCII characters are encoded in two steps: first * to a sequence of 2 or 3 bytes, using the UTF-8 algorithm; * secondly each of these bytes is encoded as "%xx". * </ul> * * @param s The string to be encoded * @return The encoded string */ public static String encode(String s) { StringBuffer sbuf = new StringBuffer(); int len = s.length(); for (int i = 0; i < len; i++) { int ch = s.charAt(i); if ('A' <= ch && ch <= 'Z') { // 'A'..'Z' sbuf.append((char)ch); } else if ('a' <= ch && ch <= 'z') { // 'a'..'z' sbuf.append((char)ch); } else if ('0' <= ch && ch <= '9') { // '0'..'9' sbuf.append((char)ch); } else if (ch == ' ') { // space sbuf.append('+'); } else if (ch == '-' || ch == '_' // unreserved || ch == '.' || ch == '!' || ch == '~' || ch == '*' || ch == '\'' || ch == '(' || ch == ')') { sbuf.append((char)ch); } else if (ch <= 0x007f) { // other ASCII sbuf.append(hex[ch]); } else if (ch <= 0x07FF) { // non-ASCII <= 0x7FF sbuf.append(hex[0xc0 | (ch >> 6)]); sbuf.append(hex[0x80 | (ch & 0x3F)]); } else { // 0x7FF < ch <= 0xFFFF sbuf.append(hex[0xe0 | (ch >> 12)]); sbuf.append(hex[0x80 | ((ch >> 6) & 0x3F)]); sbuf.append(hex[0x80 | (ch & 0x3F)]); } } return sbuf.toString(); } //end encode and //decode url private static String unescape(String s) { StringBuffer sbuf = new StringBuffer () ; int l = s.length() ; int ch = -1 ; int b, sumb = 0; for (int i = 0, more = -1 ; i < l ; i++) { /* Get next byte b from URL segment s */ switch (ch = s.charAt(i)) { case '%': ch = s.charAt (++i) ; int hb = (Character.isDigit ((char) ch) ? ch - '0' : 10+Character.toLowerCase((char) ch) - 'a') & 0xF ; ch = s.charAt (++i) ; int lb = (Character.isDigit ((char) ch) ? ch - '0' : 10+Character.toLowerCase ((char) ch)-'a') & 0xF ; b = (hb << 4) | lb ; break ; case '+': b = ' ' ; break ; default: b = ch ; } /* Decode byte b as UTF-8, sumb collects incomplete chars */ if ((b & 0xc0) == 0x80) { // 10xxxxxx (continuation byte) sumb = (sumb << 6) | (b & 0x3f) ; // Add 6 bits to sumb if (--more == 0) sbuf.append((char) sumb) ; // Add char to sbuf } else if ((b & 0x80) == 0x00) { // 0xxxxxxx (yields 7 bits) sbuf.append((char) b) ; // Store in sbuf } else if ((b & 0xe0) == 0xc0) { // 110xxxxx (yields 5 bits) sumb = b & 0x1f; more = 1; // Expect 1 more byte } else if ((b & 0xf0) == 0xe0) { // 1110xxxx (yields 4 bits) sumb = b & 0x0f; more = 2; // Expect 2 more bytes } else if ((b & 0xf8) == 0xf0) { // 11110xxx (yields 3 bits) sumb = b & 0x07; more = 3; // Expect 3 more bytes } else if ((b & 0xfc) == 0xf8) { // 111110xx (yields 2 bits) sumb = b & 0x03; more = 4; // Expect 4 more bytes } else /*if ((b & 0xfe) == 0xfc)*/ { // 1111110x (yields 1 bit) sumb = b & 0x01; more = 5; // Expect 5 more bytes } /* We don't test if the UTF-8 encoding is well-formed */ } return sbuf.toString() ; } but the decoding doesn't change it back to the original special characters. Any ideas? thanks in advance UPDATE: I tried adding these two statements to grab the request String itemdescription = URLDecoder.decode(request.getParameter("itemdescription"), "UTF-8"); String itemshortdescription = URLDecoder.decode(request.getParameter("itemshortdescription"), "UTF-8"); System.out.println("processRequest | short descrip "); and this is failing as well if that helps. UPDATE2: I created an html form and did a direct insert with the encoded itemdescription such as and the insertion works correctly with the special charaters and everything. I guess there is something going on with my javascript submit. Any ideas on this?

    Read the article

  • Url encode and routing?

    - by Curtis White
    I'm using custom routing in a web forms context. I have some titles (part of my custom route) that have say a question mark character. When I URL encode this text ("Question?") and then pass into my route, I get an HTTP ERROR CODE 400. Apparently, the URL encoded text is somehow confusing the routing manager. Can someone provide context and explanation for this? Beyond that, I'm thinking I don't need to URL encode these route data but merely strip out the problem characters. Are there any security risks to not using URL decode/encode? And what are the problem characters? A list would be useful. Thanks!

    Read the article

  • GWT: library for encoding/decoding arbitrary data in URL fragments

    - by Caffeine Coma
    Ajax applications, and GWT in particular, use the URL fragment (e.g. http://example.com/myapp#fragment) to maintain application state on the client without reloading the page. Is there a GWT library that facilitates the encoding and decoding of arbitrary parameters into the URL fragment? I'm looking for something analogous to the Servlet API's getParameter() method, but for client-side URL parameters.

    Read the article

  • How to decode a html string using xslt

    - by John ClearZ
    I am trying to style an rss feed using xslt. I want to display an image that is stored in the tag on the feed. The problem is it is encoded to display as text on the page instead of being rendered. The following is an example of part of the string. 1). <description>&lt;img src="http&amp;#58;&amp;#47;&amp;#47;buavhw.blu.livefilestore.com&amp;#47;y1ppCokLxFJSG2cmyPdvg... I had to add extra coding to the string above to get it to appear properly here. The string below is how it appears when I paste it directly into the text box. 2). <description><img src="http&#58;&#47;&#47;buavhw.blu.livefilestore.com&#47;y1ppCokLxFJSG2cmyPdvg... If I copy and paste it again from the preview window it only then becomes the following string. 3). <description><img src="http://buavhw.blu.livefilestore.com/y1ppCokLxFJSG2cmyPdvg...

    Read the article

  • JQUERY AJAX, Issues with spaces being sent to the server, y?

    - by nobosh
    I'm using the following code to post to the server which is then sent to a MYSQL query to find matches via search. $.ajax({ url: '/search/spotlight/', data: "q=" + $(this).val(), success: function(data) { } }); When Q's val has spaces in it, it's creating problems. I'm wondering if I'm handling this correctly? Do I need to encode the value in the AJAX call? Or is this a problem on my backend, which is ColdFusion Right now JQUERY is posting the following to the server: /search/spotlight/?q=FirstName%20LastName is this right?

    Read the article

  • How to decode this data

    - by Nei dal bem
    I have a field in the DB that is type bytea and this is an example of the data in: \254\355\000\005sr\000\014java.net.URL\226%76\032\374\344r\003\000\007I\000\010hashCodeI\000\004portL\000\011authorityt\000\022Ljava/lang/String;L\000\004fileq\000~\000\001L\000\004hostq\000~\000\001L\000\010protocolq\000~\000\001L\000\003refq\000~\000\001xp\377\377\377\377\377\377\377\377t\000\021asm.objectweb.orgt\000\013/index.htmlq\000~\000\003t\000\004httppx I need to convert this data into readable URL, do you know how can I do that? What type of encoding is this? Thanks!

    Read the article

  • Decoding international chars in AppEngine

    - by Irro
    I'm making a small project in Google AppEngine but I'm having problems with international chars. My program takes data from the user through the url "page.html?data1&data2..." and stores it for displaying later. But when the user are using some international characters like åäö it gets coded as %F4, %F5 and %F6. I assume it is because only the first 128(?) chars in ASCII table are allowed in http-requests. Is there anyone who has a good solution for this? Any simple way to decode the text? And is it better to decode it before I store the data or should I decode it when displaying it to the user.

    Read the article

  • JQUERY AJAX, Issues with spaces being sent to the server, Why?

    - by nobosh
    I'm using the following code to post to the server which is then sent to a MYSQL query to find matches via search. $.ajax({ url: '/search/spotlight/', data: "q=" + $(this).val(), success: function(data) { } }); When Q's val has spaces in it, it's creating problems. I'm wondering if I'm handling this correctly? Do I need to encode the value in the AJAX call? Or is this a problem on my backend, which is ColdFusion Right now JQUERY is posting the following to the server: /search/spotlight/?q=FirstName%20LastName is this right?

    Read the article

  • URL decoding Japanese characters etc. in Java

    - by DanieL
    I have a servlet that receives some POST data. Because this data is x-www-form-urlencoded, a string such as ???? would be encoded to &#12469;&#12508;&#12486;&#12531;. How would I unencode this string back to the correct characters? I have tried using URLDecoder.decode("encoded string", "UTF-8"); but it doesn't make a difference. The reason I would like to unencode them, is because, before I display this data on a webpage, I escape & to &amp; and at the moment, it is escaping the &s in the encoded string so the characters are not showing up properly.

    Read the article

  • What is the best way to parse Paypal NVP in PHP?

    - by xsaero00
    I need a function that will correctly parse NVP into PHP array. I have been using code provided by paypal but it did not work for when string length was specified next to the name. Here is what i have so far. private function parseNVP($nvpstr) { $intial=0; $nvpArray = array(); while(strlen($nvpstr)) { //postion of Key $keypos= strpos($nvpstr,'='); //position of value $valuepos = strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr); /*getting the Key and Value values and storing in a Associative Array*/ $keyval=substr($nvpstr,$intial,$keypos); $vallength=$valuepos-$keypos-1; // check if the length is explicitly specified if($braketpos = strpos($keyval,'[')) { // override value length $vallength = substr($keyval,$braketpos+1,strlen($keyval)-$braketpos-2); // get rid of brackets from key name $keyval = substr($keyval,0,$braketpos); } $valval=substr($nvpstr,$keypos+1,$vallength); //decoding the respose if (isValidXMLString("<".urldecode($keyval).">".urldecode( $valval)."</".urldecode($keyval).">")) $nvpArray[urldecode($keyval)] =urldecode( $valval); $nvpstr=substr($nvpstr,$keypos+$vallength+2,strlen($nvpstr)); } return $nvpArray; } This function works most of the time.

    Read the article

  • PayPal express checkout on the shopping cart

    - by Noam Smadja
    i wish to achieve: so in my shopping cart page i set session("Payment_Amount") = total and downloaded both asp files the wizard told me. expresschecout.asp and paypalfunctions.asp. and added the API credentials to the corect place. and i add the form from their wizard: <form action='expresscheckout.asp' METHOD='POST'> <input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/> </form> But when i go to my shopping cart and press on the paypal submit button i am taken to expressheckout.asp but the page stays whit, saying Done in the status bar. how can i debug that? :/ EDIT ADDED MY CODE, ASP: <!-- #include file ="paypalfunctions.asp" --> <% ' ================================== ' PayPal Express Checkout Module ' ================================== On Error Resume Next '------------------------------------ ' The paymentAmount is the total value of ' the shopping cart, that was set ' earlier in a session variable ' by the shopping cart page '------------------------------------ paymentAmount = Session("Payment_Amount") '------------------------------------ ' The currencyCodeType and paymentType ' are set to the selections made on the Integration Assistant '------------------------------------ currencyCodeType = "USD" paymentType = "Sale" '------------------------------------ ' The returnURL is the location where buyers return to when a ' payment has been succesfully authorized. ' ' This is set to the value entered on the Integration Assistant '------------------------------------ returnURL = "http://www.noamsm.co.il/index.asp" '------------------------------------ ' The cancelURL is the location buyers are sent to when they click the ' return to XXXX site where XXX is the merhcant store name ' during payment review on PayPal ' ' This is set to the value entered on the Integration Assistant '------------------------------------ cancelURL = "http://www.noamsm.co.il/index.asp" '------------------------------------ ' Calls the SetExpressCheckout API call ' ' The CallShortcutExpressCheckout function is defined in the file PayPalFunctions.asp, ' it is included at the top of this file. '------------------------------------------------- Set resArray = CallShortcutExpressCheckout (paymentAmount, currencyCodeType, paymentType, returnURL, cancelURL) ack = UCase(resArray("ACK")) If ack="SUCCESS" Then ' Redirect to paypal.com ReDirectURL( resArray("TOKEN") ) Else 'Display a user friendly Error on the page using any of the following error information returned by PayPal ErrorCode = URLDecode( resArray("L_ERRORCODE0")) ErrorShortMsg = URLDecode( resArray("L_SHORTMESSAGE0")) ErrorLongMsg = URLDecode( resArray("L_LONGMESSAGE0")) ErrorSeverityCode = URLDecode( resArray("L_SEVERITYCODE0")) End If %> i am guessing i am getting one of the errors from the bottom but cant find where to see thm..

    Read the article

  • How to get full query string parameters not UrlDecoded

    - by developerit
    Introduction While developing Developer IT’s website, we came across a problem when the user search keywords containing special character like the plus ‘+’ char. We found it while looking for C++ in our search engine. The request parameter output in ASP.NET was “c “. I found it strange that it removed the ‘++’ and replaced it with a space… Analysis After a bit of Googling and Reflection, it turns out that ASP.NET calls UrlDecode on each parameters retreived by the Request(“item”) method. The Request.Params property is affected by this two since it mashes all QueryString, Forms and other collections into a single one. Workaround Finally, I solve the puzzle usign the Request.RawUrl property and parsing it with the same RegEx I use in my url re-writter. The RawUrl not affected by anything. As its name say it, it’s raw. Published on http://www.developerit.com/

    Read the article

  • PHP doesn't properly URL-decode POST values, or is the bug somewhere else?

    - by Vilx-
    I have a PHP website that integrates with PayPal. As part of it's normal operation it sends a POST request to a user defined URL about every transaction (and some other events). It's called IPN for those who know. All was/is working just fine, until we moved to a new hosting provider last week. This naturally resulted in downtime, changing DNS entries, PHP misconfigurations, etc. In short - PayPal was unable to send the notifications for a few days. Now, this is not that bad, because there is an option just for that - you can log into PayPal, go to the appropriate menu item, and have it resend the failed notifications. Which we did, and it resulted in over 400 error emails. The problem is that normally the email of the receiver ($_POST['business']) is received by PHP as [email protected], but when resending it comes out as my%40business.com. And the request validation goes crazy. Obviously either something somewhere is missing a call to urldecode() or something is doing one too many urlencode(). But who? Is this a bug in PHP? I've never had such a problem before, not with any POST data ever. Perhaps PayPal has a bug? Wouldn't be surprising, but then this should have been caught ages ago. Or perhaps I'm doing something wrong and I should really be calling the urldecode() myself?

    Read the article

  • Test if string is URL encoded in PHP

    - by Psytronic
    Hey guys, I've looked through the PHP Docs and can't see anything to do with this, so how can I test if a string is URL encoded? Is it better to search the string for characters which would be encoded, which aren't, and if any exist then its not encoded, or use something like this which I've made function is_urlEncoded($string){ $test_string = $string; while(urldecode($test_string) != $test_string){ $test_string = urldecode($test_string); } return (urlencode($test_string) == $string)?True:False; } $t = "Hello World how are you?"; if(is_urlEncoded($sreq)){ print "Was Encoded.\n"; }else{ print "Not Encoded.\n"; print "Should be ".urlencode($sreq)."\n"; } Which works, however not in instances where this might occur $t = "Hello%2BWorld%2B%253E%2Bhow%2Bare%2Byou%253F"; I.e. where the string has been doubly encoded, or maybe this string $t = "Hello+World%2B%253E%2Bhow%2Bare%2Byou%253F"; I.e. where most has been doubly encoded, except for one space. (Yes I don't know when this string would ever occur, but you never know)

    Read the article

  • Image download from mysql results

    - by rozatrra
    i need to give my users the opportunity to download all the images I display in my project. images are displayed from a mysql query like this: $query = mysql_query("SELECT tl.customername, tl.visitdate, tl.employeename, pz.webpath from table tl inner join pictures pz on pz.visitid = tl.visitid and pz.groupid = tl.groupid inner join agenti ag on ag.idh = tl.employeeid WHERE tl.visitdate >= '$from' AND tl.visitdate <= '$to' AND tl.employeename like '$r_employee' AND tl.customerowner like '$r_customer' AND tl.customername like '$r_customername' AND tl.visitdate like '$r_date' group by pz.webpath order by tl.customername") or die(mysql_error()); while( $associate = mysql_fetch_assoc($query)) { echo '<li> <figure> <img src="../core/includes/timthumb.php?src='.$associate['webpath'].'&w=200&h=200" /> <figcaption> <h3>'.$associate['customername'].'</h3> <h6>'.$associate['employeename'].'</h6> <h6>'.$associate['visitdate'].' </h6> '; echo '<a class="fancybox" rel="gallery" href="'.$associate['webpath'].'" title=" '.$associate['visitdate'].' / '.$associate['customername'].'">Big picture</i></a>'; echo '</figcaption> </figure> </li>'; $zip->addFromString(pathinfo ( urldecode($associate['webpath']), PATHINFO_BASENAME), urldecode($associate['webpath'])); } How can i add a download button which will save all the images as zip on user computer?

    Read the article

  • ASP.NET MVC URL decode

    - by Bryan
    I have an action like this: <%=Html.ActionLink("My_link", "About", "Home", new RouteValueDictionary { { "id", "Österreich" } }, null)%> This produces the following link: http://localhost:1855/Home/About/%C3%96sterreich I want a link which looks like this - localhost:1855/Home/About/Österreich I have tried. Server.HtmlDecode("Österreich") HttpUtility.UrlDecode("Österreich") Neither seems to be helping. What else can I try to get my desired result?

    Read the article

  • capture data from FORM using jquery/ajax/json

    - by nisardotnet
    i have few textbox on the form and when the user submit i want to capture the data and insert into db here is what my code looks like beforeSubmit: function(data) { // called just before the form is submitted var item = $("[id$='item']"); var category = $("[id$='category']"); var record = $("[id$='record']"); var json = "{'ItemName':'" + escape(item.val()) + "','CategoryID':'" + category.val() + "','RecordID':'" + record.val() + "'}"; var ajaxPage = "DataProcessor.aspx?Save=1"; //this page is where data is to be retrieved and processed var options = { type: "POST", url: ajaxPage, data: json, contentType: "application/json;charset=utf-8", dataType: "json", async: false, success: function(response) { alert("success: " + response); }, error: function(msg) { alert("failed: " + msg); } }; //execute the ajax call and get a response var returnText = $.ajax(options).responseText; if (returnText == 1) { record.html(returnText); $("#divMsg").html("<font color=blue>Record saved successfully.</font>"); } else { record.html(returnText); $("#divMsg").html("<font color=red>Record not saved successfully.</font>"); } // $("#data").html("<font color=blue>Data sent to the server :</font> <br />" + $.param(data)); }, here is what is the Data sent to the server: if i uncomment this line: // $("#data").html("Data sent to the server : " + $.param(data)); _VIEWSTATE=%2FwEPDwULLTE4ODM1ODM4NDFkZOFEQfA7cHuTisEwOQmIaj1nYR23&_EVENTVALIDATION=%2FwEWDwLuksaHBgLniKOABAKV8o75BgLlosbxAgKUjpHvCALf9YLVCgLCtfnhAQKyqcC9BQL357nNAQLW9%2FeuDQKvpuq2CALyveCRDwKgoPWXDAKhwImNCwKiwImNC1%2Fq%2BmUXqcSuJ0z0F%2FQXKM3pH070&firstname=Nisar&surname=Khan&day_fi=12&month_fi=12&year_fi=1234&lastFour_fi=777&countryPrefix_fi=1&areaCode_fi=555-555&phoneNumber_fi=5555&email_fi=nisardotnet%40gmail.com&username=nisarkhan&password=123456&retypePassword=123456 DataProcessor.aspx.cs: public partial class DataProcessor : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) ProcessAjaxRequest(); } private void ProcessAjaxRequest() { if (Request.ContentType.Contains("json") && Request.QueryString["Save"] != null) SaveMyData(); } private void SaveMyData() { //data passed in as JSON format System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); //This is all you need to parse JSON string into an JObject. //Require namespace Newtonsoft.Json.Linq; JObject jo = JObject.Parse(line); Console.WriteLine((string)jo["RecordID"]); Console.WriteLine(Server.UrlDecode((string)jo["ItemName"])); //use Server.UrlDecode to reverse the text that was escaped before it was passed in to its original state Response.Write((string)jo["CategoryID"]); //this send to responseText of .ajax(options).responseText } } the above code is not working and i need a way to capture the values before i insert into db. any help? Thanks.

    Read the article

  • Creating thumbnails PHP problem

    - by Wayne
    I have this source code where I got it from net tutsplus. I have configured it and made it work in one PHP file. It does work by transferring the original image, but it does not generate to the thumbnails folder. <?php $final_width_of_image = 100; $path_to_image_directory = "../../img/events/" . urldecode($_GET['name']) . "/"; $path_to_thumbs_directory = "../../img/events/" . urldecode($_GET['name']) . "/thumbnails/"; function createThumbnail($filename) { if(preg_match('/[.](jpg)$/', $filename)) { $im = imagecreatefromjpeg($path_to_image_directory . $filename); } elseif(preg_match('/[.](gif)$/', $filename)) { $im = imagecreatefromgif($path_to_image_directory . $filename); } elseif(preg_match('/[.](png)$/', $filename)) { $im = imagecreatefrompng($path_to_image_directory . $filename); } $ox = imagesx($im); $oy = imagesy($im); $nx = $final_width_of_image; $ny = floor($oy * ($final_width_of_image / $ox)); $nm = imagecreatetruecolor($nx, $ny); imagecopyresized($nm, $im, 0,0,0,0,$nx,$ny,$ox,$oy); imagejpeg($nm, $path_to_thumbs_directory . $filename); $tn = '<img src="' . $path_to_thumbs_directory . $filename . '" alt="image" />'; echo $tn; } if(isset($_FILES['fupload'])) { if(preg_match('/[.](jpg)|(gif)|(png)$/', $_FILES['fupload']['name'])) { $filename = $_FILES['fupload']['name']; $source = $_FILES['fupload']['tmp_name']; $target = $path_to_image_directory . $filename; move_uploaded_file($source, $target); createThumbnail($filename); } } ?> Basically it is supposed to generate a thumbnail of the uploaded image and store the original image into a different folder. The paths are correct, it works by getting the folder name in the URL, it does work, but nothing works for the thumbnails folder. BEFORE you ask this related question, yes, thumbnails generation does work on my server by the PHP GD, I have tested it separately. So this is not the problem. :) How do I get this to work? :(

    Read the article

1 2 3  | Next Page >