Removing backslashes from a string in Python
How do I remove all the backslashes from a string in Python? This is not working for me: result = result.replace("\\", result) Do I need to treat result as a raw string? ...
How do I remove all the backslashes from a string in Python? This is not working for me: result = result.replace("\\", result) Do I need to treat result as a raw string? ...
For example, urlesc["foo.cgi?abc=123"] should return foo.cgi%3Fabc%3D123 This is also known as percent-encoding. Also, for better readability, spaces should encode to pluses. I believe that's always acceptable for URL escaping. ...
This is a follow up to my last question here. The answer posted there actually does not work. So here is the challenge. You are given this code (assume jQuery included): <input type=text> <script> $("input").val(**YOUR PHP / JS CODE HERE**); </script> Using jQuery - and not by injecting PHP output directly into the input tag - fai...
I have a connection string in my web config: <add name="MyConString" connectionString="Server=dbsrv;User ID=myDbUser;Password=somepass"word" providerName="System.Data.SqlClient" /> As you see, there is a quotation sign ( " ) in the password (given from other dept. I can't change this db users password). How do I have to escape the qu...
I have a javascript function which takes a string as its parameter. This string is encoded (with %20 for spaces, %26 for ampersands, etc..). function myFunction(theParam) { alert(theParam); // outputs & } // called by the following link <a href="#" onclick='myFunction("%26")'>Do something</a> How do I stop this behavior? I wan...
I'm using tinyMCE to edit content from an existing website. This website has links in the format: http://localhost/start.jsp%3Fparam=value where the %3F is the escaped string for the question mark character. When TinyMCE edits a page containing one of these links, it converts the "%" sign into "%25" which breaks the link. How can I di...
I have some addHtml JavaScript function in my JS code. I wonder how to escape HTML/JS code properly. Basically, what I am trying right now is: addHtml("<a onclick=\"alert(\\\"Hello from JS\\\")\">click me</a>") However, that doesn't work. It adds the a element but it doesn't do anything when I click it. I don't want to replace all " ...
I have the following string: string text = @"<a href=""http://raustdsx0700.real.local:7782/analytics/saw.dll?PortalPages&PortalPath=" + dashboardURL + "&Page=" + reportName + @"&P0=1&P1=eq&P2=Project.""Project Name"" target=""_blank"">" + reportName + "</a><br/><br/>"; When this string gets written to my page, it looks like this: ...
I've got this dynamic t-sql: declare @sql nvarchar(max) set @sql = N' insert into #t SELECT row_number() over(order by getdate()) as RowNum, d.value('''+@baseDateXpath+''', ''datetime'') as basedate, pref.query(''.'') as XmlExtract FROM @content.nodes(''/*/*'') AS extract(pref) CROSS APPLY @content.nodes(''//*'') AS ...
Hmm, for some reason, its only doing this on the first username (and password) and does it for how big my my vector is. Any ideas on why? int eMysql::strip(string &input) { char* from = new char[strlen(input.c_str()) * 3 + 1]; mysql_real_escape_string(&mysql, from, input.c_str(), input.length()); input = input.assign(from); ...
Is there's any difference between char literals '\"' and '"' ? ...
Hey all, I'm a long-time vim user trying to make the switch to emacs. I'm using viper-mode in emacs and I keep typing ESC (to get out of insert mode) and then a key (say, j). I type fast and often hit them at the same time. Emacs then thinks I'm hitting META-j and runs a function which I do not intend. I like using option as meta and d...
Hello, I am uploading email addresses from a CSV file, via fgetcsv(), into a MySQL database. The problem that I am running into is that I cannot escape email addresses containing an apostrophe (or single quote). So, O'[email protected] will not become O\'[email protected] I know that this is supposed to happen, however I have been unable to f...
I have a chat window (using a <div>) that sometimes needs to get multiline entries. Until now, I've simply replaced incoming \n with <br> and displayed the text with .append(). Unfortunately, I've discovered leaving a naked .append() based on user input allows the user to insert arbitrary HTML, which will then be executed by the browser....
My code is littered with things like this Write (thePhpFile, ' echo "<option value=\"' + theControl.Name + '_selection\">" . $' + theControl.Name + '_values[$_POST["' + ...
Escaping * char in cshell alias i want to write a C Shell Alias which can find files starting with a pattern ie equivalent of find . -name "pattern*" myfind pattern should do above cmd where myfind is the alias name. How do i escape the * in csh alias ? alias myfind 'find . -name !**' ...
(This is classic ASP) I'm sure this is just a case of escaping the text, but I haven't found anything yet. I have a textarea that may contain all sorts of characters and I need to UPDATE the record with whatever is in that textarea, but I'm getting an error that breaks my SQL query, which I'm positive is related to the content of the tex...
I am retrieving a value from our DB using JSTL. I am inserting it right into some javascript to use it as a variable. I need the output of the value the JSTL is holding to be escaped because if there are single or double quotes it breaks my script. The value is user specified. Example: Doing the following: <c:set var="myVar" value="Da...
I use Rails RESTful routing to generate URLs for one resource in my application. My resource ID contains some special characters. The confusing part is that in the generated URL, when I look in the HTML, is double escaped. For instance, /item/item+one get escaped to /item/item%252Bone instead of /item/item%2Bone. When getting the ID par...
I came accross an opensource code in views, with a 't()' tag similar to html escape sequence, i.e h(). <%= f.label :password, t(:password, :scope => "activerecord.attributes.user") -%> I just want to know what t() means.. Anyone? ...