escaping

Do I need to escape characters in this MATLAB string?

陌路散爱 提交于 2019-12-13 12:14:42
问题 I would like to call the following bash command in MATLAB: grep "Up to" ~/test_linux/vision1.1/log | awk '{print $7}' I use system() in MATLAB, but it turns out to have errors: >> [status string]=system('grep "Up to" ~/test_linux/vision1.1/log | awk '{print $7}' '); ??? [status string]=system('grep "Up to" ~/test_linux/vision1.1/log | awk '{print $7}' '); Error: Unbalanced or unexpected parenthesis or bracket. Do I need to escape some special characters in the bash command as a string in

What is the Bash Escape Character “\c”?

人盡茶涼 提交于 2019-12-13 11:54:04
问题 What is the name and function of the \c escape character in Bash? What is its numeric value? I have seen that \cx is a control character, but what about plain \c ? It seems that: echo -e "Hello World\c" and echo -en "Hello World" are equivalent. However, Python doesn't use it as an escape character, and it is missing from all of the lists of escape characters I found. Is this a Bash-specific behavior? 回答1: That's actually specific to some versions of echo (I'm pretty sure that \c came from

Escaping characters by doubling them in PHP

我与影子孤独终老i 提交于 2019-12-13 10:21:16
问题 Is there a simple way to escape/unescape an arbitrary character in PHP by doubling it, for example: in ANSI SQL, "you can ""escape"" this way" in printf(), you can express a %% this way Escaping is quite easy with str_replace() , but reversing the process to unescape the string is not that easy, so does anyone know of a pair of functions, or a library to do this? The idea is that I need to serialize an array this way: array('a','b', '~','c') => 'a~b~~~~c' The individual strings cannot be

How to remove a file beginning with a dash (in Unix like mode) [duplicate]

吃可爱长大的小学妹 提交于 2019-12-13 10:19:58
问题 This question already has answers here : How do I deal with a filename that starts with the hyphen (-) character? (4 answers) Closed 4 years ago . I have accidentally created a file in GitBash (a Unix like environment) with the name - -l (I have absolutely no idea how I managed to do this in the first place :) Johnny (master #) scipy-tentative-numpy-tutorials $ ls -l total 1 -rw-r--r-- 1 Johnny Administ 956 May 7 16:24 - -l -rw-r--r-- 1 Johnny Administ 562 May 7 16:21 README.md I wish to

PHP what happens when a string is double times mysqli_real_escape_string

纵饮孤独 提交于 2019-12-13 09:34:48
问题 I'm using mysqli. When I echo mysqli_real_escape_string($db,mysqli_real_escape_string($db,'"')); which one of those will be the output: 1. \" 2. \\\" ? Is there a safe way to check whether a string has been already escaped? Unfortunately, I cannot test at present as I cannot access MySQL for 24 hours. 回答1: The output is \\\" (your second example). I don't think you can reliably say whether a string has already been escaped or not, you should organize your code in a way that you only can call

So we've got our HTML escape functions that really work in a C++ manner, how to do unescape?

北慕城南 提交于 2019-12-13 08:56:33
问题 Here I've found a grate way to HTML encode/escape special chars. Now I wonder how to unescape HTML encoded text in C++? So codebase is: #include <algorithm> namespace xml { // Helper for null-terminated ASCII strings (no end of string iterator). template<typename InIter, typename OutIter> OutIter copy_asciiz ( InIter begin, OutIter out ) { while ( *begin != '\0' ) { *out++ = *begin++; } return (out); } // XML escaping in it's general form. Note that 'out' is expected // to an "infinite"

XSLT convert xml block under a specific node to xml-escaped content of that node

北城以北 提交于 2019-12-13 07:43:22
问题 Any ideas of how the following problem can be solved would be highly appreciated. INPUT: <p> <div> Original<br/>This is the original <b>acid</b>, a hydroxy monocarboxylic <span class="hl1">acid</span>. </div> </p> Desired Output: <p> <div> Original<br/>This is the original <b>acid</b>, a hydroxy monocarboxylic <span class="hl1">acid</span>. </div> </p> Attempt 1: `<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output omit-xml-declaration="yes" indent="no

Losing non printable ascii character (group separator) when deserializing with JsonConvert.DeserializeObject (Newtonsoft.Json)

余生长醉 提交于 2019-12-13 07:15:36
问题 I have a frustrating problem that I'm unable to solve. I am using Newtonsoft.Json to deserialize some .json data. I can plainly see in the raw json string that there are character sequences { '\\', 'u', '0', '0', '1', 'd' } This represents "group separator" (ascii 29 or 0x1D). However, when I deserialize using JsonConvert.DeserializeObject<> these character sequences are not put correctly into their objects. What is put in instead is simply 1D. That is if you look at the character array you

Escape Quote in C# for javascript consumption

假装没事ソ 提交于 2019-12-13 06:58:57
问题 I have a ASP.Net web handler that returns results of a query in JSON format public static String dt2JSON(DataTable dt) { String s = "{\"rows\":["; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { s += "{"; for (int i = 0; i < dr.Table.Columns.Count; i++) { s += "\"" + dr.Table.Columns[i].ToString() + "\":\"" + dr[i].ToString() + "\","; } s = s.Remove(s.Length - 1, 1); s += "},"; } s = s.Remove(s.Length - 1, 1); } s += "]}"; return s; } The problem is that sometimes the data returned

JavaScript Escaping Form Values

佐手、 提交于 2019-12-13 06:50:21
问题 I know there are a lot of JavaScript escaping questions, but nothing seemed to fit my needs. I have textarea elements being dynamically displayed on a JSP. In the case of invalid form submits, I need to repopulate these fields with the values the user entered. I am doing this like so (note: simplified version): var textareaBox = document.getElementById("myTextArea"); if (textareaBox) { textareaBox.value = '${myForm.myValue}'; } Everything works fine until the user enters a value in the box