Search Results

Search found 390 results on 16 pages for 'escaping'.

Page 6/16 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Literal ampersands in System.Uri query string

    - by Nathan Baulch
    I'm working on a client app that uses a restful service to look up companies by name. It's important that I'm able to include literal ampersands in my queries since this character is quite common in company names. However whenever I pass %26 (the URI escaped ampersand character) to System.Uri, it converts it back to a regular ampersand character! On closer inspection, the only two characters that aren't converted back are hash (%23) and percent (%25). Lets say I want to search for a company named "Pierce & Pierce": var endPoint = "http://localhost/companies?where=Name eq '{0}'"; var name = "Pierce & Pierce"; Console.WriteLine(new Uri(string.Format(endPoint, name))); Console.WriteLine(new Uri(string.Format(endPoint, Uri.EscapeUriString(name)))); Console.WriteLine(new Uri(string.Format(endPoint, Uri.EscapeDataString(name)))); All three of the above combinations return: http://localhost/companies?where=Name eq 'Pierce & Pierce' This causes errors on the server side since the ampersand is (correctly) interpreted as a query arg delimiter. What I really need it to return is the original string: http://localhost/companies?where=Name eq 'Pierce %26 Pierce' How can I work around this behavior without discarding System.Uri entirely? I can't replace all ampersands with %26 at the last moment because there will usually be multiple query args involved and I don't want to destroy their delimiters. Note: A similar problem was discussed in this question but I'm specifically referring to System.Uri.

    Read the article

  • Why are $_POST variables getting escaped in PHP?

    - by George Edison
    When my PHP script receives data from an AJAX POST request, the $_POST variables are escaped. The really strange thing is that this only happens on my production server (running PHP 5.2.12 on Linux) and not on my local server (running PHP 5.3.1 on Windows). Here is the AJAX code: var pageRequest = false; if(window.XMLHttpRequest) pageRequest = new XMLHttpRequest(); else if(window.ActiveXObject) pageRequest = new ActiveXObject("Microsoft.XMLHTTP"); pageRequest.onreadystatechange = function() { } var q_str = 'data=' + " ' "; pageRequest.open('POST','unnamed_page.php',true); pageRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); pageRequest.setRequestHeader("Content-length", q_str.length); pageRequest.setRequestHeader("Connection", "close"); pageRequest.send(q_str); Is there any reason this is happening? And how should I fix this so that it works on both servers?

    Read the article

  • How do I write unescaped XML outside of a CDATA

    - by kazanaki
    Hello I am trying to write XML data using Stax where the content itself is HTML If I try xtw.writeStartElement("contents"); xtw.writeCharacters("<b>here</b>"); xtw.writeEndElement(); I get this <contents>&lt;b&gt;here&lt;/b&gt;</contents> Then I notice the CDATA method and change my code to: xtw.writeStartElement("contents"); xtw.writeCData("<b>here</b>"); xtw.writeEndElement(); and this time the result is <contents><![CDATA[<b>here</b>]]></contents> which is still not good. What I really want is <contents><b>here</b></contents> So is there an XML API/Library that allows me to write raw text without being in a CDATA section? So far I have looked at Stax and JDom and they do not seem to offer this. In the end I might resort to good old StringBuilder but this would not be elegant. Update I agree mostly with the answers so far. However instead of <b>here</b> I could have a 1MB HTML document that I want to embed in a bigger XML document. What you suggest means that I have to parse this HTML document in order to understand its structure. I would like to avoid this if possible.

    Read the article

  • How can I put double quotes inside a string within an ajax JSON response?

    - by karlthorwald
    I receive a JSON response in an Ajax request from the server. This way it works: { "a" = "1", "b" = "hello 'kitty'" } But I did not succeed in putting double quotes around kitty. When I convert " to \x22 in the Ajax response, it is still interpreted as " by JavaScript and I cannot parse the JSON. Should I also escape the \ and unescape later (which would be possible)? How to do this? Edit: I am not sure if i expressed it well: I want this string inside of "b" after the parse: hello "kitty" If necessary I could also add an additional step after the parse to convert "b", but I guess it is not necessary, there is a more elegant way so this happens automatically?

    Read the article

  • How to unescape String in Rails

    - by Midday
    I have a long String from a WYSIWYG (in my case YUI) which I then send as html email. since its an email all CSS needs to be inline so how should i unescape this: <span style=\"color: #c00000; font-size: 14px;\"> Is .gsub '\"' , '"' enough?

    Read the article

  • How to escape parameter in windows command line?

    - by Rryk
    I need to run the following command from the command line in Windows 7: SumatraPDF.exe -inverse-search "\"C:\Program Files\eclipse\inverse_search.bat\" \"%f\" %l" However I need to modify it a little, since my installation of Eclipse is located in here: C:\Program Files (x86)\Eclipse (C++) How do I escape this line correctly? Do I need to escape parenthesis and pluses too? Or is it just enough to escape double quotes?

    Read the article

  • Drupal incorrectly escapes tags in javascript

    - by sergdev
    I installed drupal-6.16. I applied the patch from the post http://drupal.org/node/222926#comment-930745. It works correctly in simple cases. But following code of counter is handled incorrectly and counter is now displayed on the page after drupal. Drupal modifies the string "alt='1Gb.ua counter' /><\/a>")</a></script> to "alt='1Gb.ua counter' />&lt;\/a>")</a></script> The full code of counter follows: <br><br> Text <br><br> <!-- counter.1Gb.ua --> <script language="javascript" type="text/javascript"> cgb_js="1.0"; cgb_r=""+Math.random()+"&r="+ escape(document.referrer)+"&pg="+ escape(window.location.href); document.cookie="rqbct=1; path=/"; cgb_r+="&c="+ (document.cookie?"Y":"N"); </script><script language="javascript1.1" type="text/javascript"> cgb_js="1.1";cgb_r+="&j="+ (navigator.javaEnabled()?"Y":"N")</script> <script language="javascript1.2" type="text/javascript"> cgb_js="1.2"; cgb_r+="&wh="+screen.width+ 'x'+screen.height+"&px="+ (((navigator.appName.substring(0,3)=="Mic"))? screen.colorDepth:screen.pixelDepth)</script> <script language="javascript1.3" type="text/javascript"> cgb_js="1.3"</script> <script language="javascript" type="text/javascript">cgb_r+="&js="+cgb_js; document.write("<a href='http://www.1Gb.ua?cnt=1416'>"+ "<img src='http://counter.1Gb.ua/cnt.aspx?"+ "u=1416&"+cgb_r+ "&' border=0 width=88 height=31 "+ "alt='1Gb.ua counter'><\/a>")</script> <noscript><a href='http://www.1Gb.ua?cnt=1416'> <img src="http://counter.1Gb.ua/cnt.aspx?u=1416" border=0 width="88" height="31" alt="1Gb.ua counter"></a> </noscript> <!-- /counter.1Gb.ua --> Does anybody have this code working? How can it be fixed? Thanks a lot in advance!

    Read the article

  • Creating an mailto: URL with a URL in the body iPhone SDK

    - by Sjakelien
    UPDATE: I just found a similar post here: http://stackoverflow.com/questions/730101/how-do-i-encode-in-a-url-in-an-html-attribute-value Please consider the code below: I try to send an email message from within my iPhone app. The problem I encounter is that I want to put a URL in the body of the email. This URL contains two ampersands. I am encoding all the strings using "stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding", but the URL ends up in my new mail messagd truncated after the first ampersand. IE: "http://www.mydomain.nl/?cm=79&ctime=1246572000&cid=4772" becomes "http://www.mydomain.nl/?cm=79". Any suggestion what I could do to escape? NSString *eMailSubject = @"My Subject"; NSString *encodedSubject = [[NSString alloc] initWithString:[eMailSubject stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSString *eMailBody = @"http://www.mydomain.nl?cm=79&ctime=1246572000&cid=4772"; NSString *encodedBody = [[NSString alloc] initWithString:[eMailBody stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSString *urlString = [[NSString alloc] initWithString:[NSString stringWithFormat:@"mailto:?subject=%@&body=%@", encodedSubject, encodedBody]]; NSString *encodedURL = [[NSString alloc] initWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; NSURL *url = [[NSURL alloc] initWithString:encodedURL]; [[UIApplication sharedApplication] openURL:url];

    Read the article

  • Jquery taconite selector with character that needs to be escaped

    - by hdx
    I'm using the jquery taconite plugin to make an ajax request that will replace a certain element in my page, however the element has an id like "email.subject".. I can select it just fine if I do '$("email\\.subject")', but when I try to use the taconite plugin like this: <taconite> <replaceWith select="#email\\.subject"> JUCA </replaceWith> </taconite> The plugin log says: [taconite] No matching targets for selector: #email\\.subject How can I make this work?

    Read the article

  • system() copy fails, while cmd copy works

    - by Mike
    In cmd.exe, I can execute the command "copy c:\hello.txt c:\hello2.txt" and it worked fine. But in my C program, I ran this piece of code and got the following error: #include <iostream> using namespace std; int main() { system("copy c:\hello.txt c:\hello2.txt"); system("pause"); return 0; } Output: The system cannot find the file specified. Anybody know what is going on here?

    Read the article

  • @ in p4 filename

    - by Denise
    I'd like to script p4 a little. Unfortunately, some of the filenames that we're tracking have "@" in the filename. The filenames are in the form [email protected]. If I try to do something like p4 sync a\@b.xml on a mac (or p4 sync [email protected] on windows) it gives the error: Invalid changelist/client/label/date '@b.xml' Is there another way to escape it that perforce will recognize?

    Read the article

  • do we need to escape the character '<'

    - by Ozkan
    In C# ASP.NET, if we have the characters < or in a string. Do we need to escape it like: string a = "\<test\>abcdef\</test\>" because this string will be send to an external method via webservices. And in that method, it will be converted to a some kind of xml file. contentHtml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" + contentHtml; content_ws.AddContent(contentHtml); //AddContent() method is a external method (via webservices) Thx for help

    Read the article

  • Why does _GET in PHP wrongly decodes slash?

    - by Boaz
    Hi, Today I run into some oddity with PHP, which I fail find a proper explanation for in the documentation. Consider the following code: <?php echo $_GET['t']. PHP_EOL; ?> The code is simple - it takes a single t parameter on the url and outputs it back. So if you call it with test.php?t=%5Ca (%5c is a '\'), I expected to see: \a However, this is what I got: $ curl http://localhost/~boaz/test.php?t=%5Ca \\a Notice the double slash. Can anyone explains what's going on and give recipe for retrieving the strings as it was supplied on the URL? Thanks, Boaz

    Read the article

  • Passing a Batch File an Argument Containing a Quote Containing a Space

    - by Synetech inc.
    Hi, On many occasions I have dealt with passing batch files arguments with spaces, quotes, percents, and slashes and all sorts of combinations of them. Usually I managed to figure out how to accomplish what I want, but this time I am stuck. I have tried a couple of hundred combinations now and my head is starting to hurt. I’ve reduced the problem quite nicely. It’s a simple requirement: pass a double-quoted space from one batch file to another. That is, one batch file should pass some string X to another so that the the second one echos " ". I just can’t figure out what X should be. Here is a minimal batch file that demonstrates and attempt that does not work. (This BAT file takes the place of both by calling itself.) ::Goal is to print: ::" " ::That is, to pass a quoted space from a BAT file to a BAT file if not (%1)==() goto recurse %0 "" "" :recurse echo %1 pause It does not work. I’ve tried using "\" \"", """ """, """" """", "\"" "\"", ""\" \""", "^" ^"", ^"" "^", and so on. Either they print double double-quotes, lose everything after the space, or something else (that is wrong). Any ideas? Thanks.

    Read the article

  • Drupal incorrectly espaces tags in javascript

    - by sergdev
    I installed drupal-6.16. I applied the patch from the post http://drupal.org/node/222926#comment-930745. It works correctly in simple cases. But for following code for counter is handled incorrectly: <br><br> Text <br><br> <!-- counter.1Gb.ua --> <script language="javascript" type="text/javascript"> cgb_js="1.0"; cgb_r=""+Math.random()+"&r="+ escape(document.referrer)+"&pg="+ escape(window.location.href); document.cookie="rqbct=1; path=/"; cgb_r+="&c="+ (document.cookie?"Y":"N"); </script><script language="javascript1.1" type="text/javascript"> cgb_js="1.1";cgb_r+="&j="+ (navigator.javaEnabled()?"Y":"N")</script> <script language="javascript1.2" type="text/javascript"> cgb_js="1.2"; cgb_r+="&wh="+screen.width+ 'x'+screen.height+"&px="+ (((navigator.appName.substring(0,3)=="Mic"))? screen.colorDepth:screen.pixelDepth)</script> <script language="javascript1.3" type="text/javascript"> cgb_js="1.3"</script> <script language="javascript" type="text/javascript">cgb_r+="&js="+cgb_js; document.write("<a href='http://www.1Gb.ua?cnt=1416'>"+ "<img src='http://counter.1Gb.ua/cnt.aspx?"+ "u=1416&"+cgb_r+ "&' border=0 width=88 height=31 "+ "alt='1Gb.ua counter'><\/a>")</script> <noscript><a href='http://www.1Gb.ua?cnt=1416'> <img src="http://counter.1Gb.ua/cnt.aspx?u=1416" border=0 width="88" height="31" alt="1Gb.ua counter"></a> </noscript> <!-- /counter.1Gb.ua --> It modifies the string "alt='1Gb.ua counter' /><\/a>")</a></script> to "alt='1Gb.ua counter' />&lt;\/a>")</a></script> Does anybody have this code working? If so how this can be fixed? Thanks a lot in advance!

    Read the article

  • ASP.NET MVC routing issue: How to allow "\" in id's

    - by Bipul
    I am using following route map routes.MapRoute( "RenderAssociatedForm", "DoAction/{nodeLevelId}/{nodeSystemId}", new { controller = "FrontEnd", action = "RenderAssociatedForm", }); Now nodeLevelId can be anything like zs\bbal. As we know that we should escape '\', so we are using 'zs%5cbbal'. But still the following url is not mapping to this route. //localhost/DoAction/zs%5cbbal/5 When I try simple Id without the escape character, it maps properly. Can anybody tell me where I am going wrong?

    Read the article

  • Converting &amp; to & in Objective-C

    - by nbojja
    Hi All, I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&amp;web=%2F&amp;page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace &amp; with & in the above URL. My result should be: http://myserver.com/_layouts/feed.aspx?xsl=4&web=%2F&page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&amp;wp=476f174a-82df-4611-a3df-e13255d97533 Can someone post me the code to get this done? Thanks

    Read the article

  • escape double quote in vb string

    - by JKS
    i have used following piece of code to execute schtasks command from vb6 while executing it ignores folder if it contains space For example "C:\program files\test\test.exe" will be converted to "c:\program " how do i solve this issue? MyAppname = Chr(34) & App.Path & "\" & App.EXEName & ".exe" & Chr(34) StrCommand = "schtasks /create /sc ONLOGON /RL HIGHEST /tn myapp /tr " & MyAppname Shell StrCommand, vbHide thanks in advance

    Read the article

  • How to avoid malformed URI sequence error?

    - by Luci
    I'm working with perl. I have data saved on database as  “ and I want to escape those characters to avoid having malformed URI sequence error on the client side. This error seems to happen on fire fox only. The fix I found while googling is not to use decodeURI , yet I need this for other characters to be displayed correctly. Any help? uri_escape does not seem enough on the server side. Thanks in advance. Detalils: In perl I'm doing the following: print "<div style='display:none;' id='summary_".$note_count."_note'>".uri_escape($summary)."</div>"; and on the java script side I want to read from this div and place it on another place as this: getObj('summary_div').innerHTML= unescape(decodeURI(note_obj.innerHTML)); where the note_obj is the hidden div that saved the summary on perl. When I remove decodeURI the problem is solved, I don't get malformed URI sequence error on java script. Yet I need to use decodeURI for other characters. This issue seems to be reproduced on firefox and IE7.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >