escaping

Colorize logs in eclipse console

Is there a way to colorize parts of logs in the eclipse console. I know I could send to error and standard streams and color them differently but I'm more looking someting in the lines of ANSI escape codes (or anyother, HTML ?) where I could embed the colors in the string to have it colored in the logs. It sure would help making the im...

system() copy fails, while cmd copy works

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 fi...

C# code to convert XHTML doc to plain text

I'm writing a utility to export evernote notes into Outlook on a schedule. The Outlook API's need plain text, and Evernote outputs a XHTML doc version of the plain text note. What I need is to strip out all the Tags and unescape the source XHTML doc embedded in the Evernote export file. Basically I need to turn; <note> <title>Test Sy...

Escape path separator in a regular expression

I need to write a regular expression that finds javascript files that match <anypath><slash>js<slash><anything>.js For example, it should work for both : c:\mysite\js\common.js (Windows) /var/www/mysite/js/common.js (UNIX) The problem is that the file separator in Windows is not being properly escaped : pattern = Pattern.compil...

Regexp for quoted string with escaping quotes

How to get substring " It's big \"problem " using a regexp s = ' function(){ return " Is big \"problem "; }'; ...

Java -> Apache Commons StringEscapeUtils -> escapeJavaScript

For a very simple ajax name lookup, I'm sending an id from the client webpage to the server (Tomcat 5.5, Java 5), looking it up in a database and returning a string, which is assigned to a javascript variable back in the client (and then displayed). The javascript code that receives the value is pretty standard: //client code - javascr...

Why vim doesn't work correctly into a telnet session ?

Hello, I use vim (7.1) on OpenVMS V7.3-2. I connect to VMS trough a telnet session with SmartTerm, a terminal emulator. It works fine. But when I start a telnet session from a VMS session (connected via SmartTerm) to another VMS session, some keys doesn't work properly. |--------------| telnet |-------------| telnet |-----------...

How does one insert a backslash or a tilde into LaTeX?

How does one insert "\" (backslash) into the text of a LaTeX document? And how does one insert a "~" (tilde)? (If you insert \~, it will give you a tilde as an accent over the following letter.) I believe \backslash may be used in math formulae, but not into text itself. Lamport's, Kopka's, and Mittelbach's texts have said as much (b...

Escaping dilemma in Javascript.

Hi everyone, I have the following var id='123'; newDiv.innerHTML = "<a href=\"#\" onclick=\" TestFunction('"+id+"', false);\"></a>"; Which renders <a href="#" onclick="return Testfunction('123',false);"></a> in my HTML. The problem I have is that I wish to take the call to the method TestFunction, and use as a string parameter in m...

In Delphi 7, how do I escape a percent sign (%) in the Format function?

I want to do something like this: SQL.Text := Format('select foo from bar where baz like ''%s%''',[SearchTerm]); But Format doesn't like that last '%', of course. So how can I escape it? \%? %%? Or do I have to do this: SQL.Text := Format('select foo from bar where baz like ''%s''',[SearchTerm+'%']); ? ...

Double-Escaped Unicode Javascript Issue

I am having a problem displaying a Javascript string with embedded Unicode character escape sequences (\uXXXX) where the initial "\" character is itself escaped as "&#92;" What do I need to do to transform the string so that it properly evaluates the escape sequences and produces output with the correct Unicode character? For example, I...

Shouldn't mysql_real_escape_string() leave slashes in Database?

Hello Im using smarty and mysql_real_escape_string() for user input, and when I insert some code with ' or " , and lookup in phpmyadmin it shows without backslashes. When I get record from DB i doesn't have backslashes also. But when I just pass escaped string without inserting into the db it is backslashed. Shouldn't it add slashes, ...

Render < instead of < in ASP.NET

I'm writing a small page to show the employees in our company. I've written a query to pull the info from our database. Then I'm binding that to a GridView to do the dirty work. Here is the query. "SELECT tblEmpID.empid AS [Empl ID], tblEmpID.posno AS [Pos #], [name] & ""<br />"" & [jcn] & ""("" & [jcc] & "")"" AS [Name/Job], [orgno]...

How does one escape characters in Delphi string

Delphi strings use single quotes, for example 'a valid string'. How does one specify the ' character within a literal string? How would one refer to the null byte (Unicode code point U+0000)? ...

escaping html inside comment tags

escaping html is fine - it will remove <'s and >'s etc. ive run into a problem where i am outputting a filename inside a comment tag eg. <!-- ${filename} --> of course things can be bad if you dont escape, so it becomes: <!-- <c:out value="${filename}"/> --> the problem is that if the file has "--" in the name, all the html gets scre...

What's the Magic Behind Escape(\) Character

How does the C/C++ compiler manipulate the escape character ["\"] in source code? How is compiler grammar written for processing that character? What does the compiler do after encountering that character? ...

Can I convert a C# string value to an escaped string literal

In C#, can I convert a string value to a string literal, the way I would see it in code? I would like to replace tabs, newlines, etc. with their escape sequences. If this code: Console.WriteLine(someString); produces: Hello World! I want this code: Console.WriteLine(ToLiteral(someString)); to produce: \tHello\r\n\tWorld!\r\n ...

XML editor with proper copy and paste?

I'm looking for an XML editor that lets me type and copy and paste arbitrary text into an XML element or attribute without requiring me to go back through and escape any characters that must use reserved XML entities (ampersands, angle brackets, or quote marks). XMLSpy came up short. ...

How to escape everything in a block in HTML

I seem to recall that there is an HTML tag that escapes absolutely everything inside it except the matching closing tag. Kind of like <plaintext> but not fundamentally broken. ...

Is there a better HTML escaping and unescaping tool than CGI for Ruby?

CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('&#8230;') # => "…" # correct - an ellipsis CGI.unescapeHTML('&hellip;') # => "&hellip;" # should be "…" CGI.unescapeHTML('&#162;') # => "\242" # correct - a cent CGI.un...