escaping

Escape multiple “%” characters in Android

為{幸葍}努か 提交于 2019-12-08 14:36:14
问题 In <string-array name="versions"> I have this beast of an entry (boiled down to a reasonable minimum to reproduce the effect): <item>100% foo 40%bar</item> which produces these errors: Multiple annotations found at this line: - error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? - error: Found tag </item> where </string-array> is expected Adding formatted="false" doesn't change a thing. <item>100% foo 40%bar</item> results in

How to detect an invalid C escaped string using a regular expression?

独自空忆成欢 提交于 2019-12-08 12:02:10
问题 I would like to find a regular expression (regex) that does detect if you have some invalid escapes in a C double quoted escaped string (where you can find double quotes only escaped). I consider valid \\ \n \r \" (the test string is using ") A partial solution to this is to use (?<!\\)\\[^\"\\nr] but this one fails to detect bad escapes like \\\ . Here is a test string that I use to test the matching: ...\n...\\b...\"...\\\\...\\\E...\...\\\...\\\\\..."...\E... The expression should match

Backslash breaks string interpolation in ruby [closed]

白昼怎懂夜的黑 提交于 2019-12-08 12:02:06
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 6 years ago . I'd like to end up with the string "/a_setting/c\blah = something" where attribute gets evaluated to its value: blah. However, I'm seeing the following behavior where the preceding backslash seems to stop the evaluation of the variable: attribute = "blah" "/a_setting/c\#{attribute} = something" =>

MASM : How do you declare a string with carriage return?

天涯浪子 提交于 2019-12-08 11:26:37
问题 I would like to know if it is possible in MASM to write special character in string. HelloWorld db "Hello World!\r\n", 0 Would be an intuitive way but it does not work. Thanks. 回答1: The ASCII codes for CR and LF are 13 and 10, so: HelloWorld db "Hello World!",13,10,0 来源: https://stackoverflow.com/questions/22090605/masm-how-do-you-declare-a-string-with-carriage-return

SSH - Connect & Execute : “echo $SSH_CONNECTION | awk '{print $1}'”

落爺英雄遲暮 提交于 2019-12-08 09:38:09
问题 Here's my bash (shell?) script. command="ssh root@$ip"; command2="\"ls /;bash\""; xfce4-terminal -x sh -c "$command $command2; bash" connects to the server and executes the command of ls / works just fine. But instead of ls / .. I want to execute this command: echo $SSH_CONNECTION | awk '{print $1}' I replaced " ls / " with the code above, but soon as it connects, it simply prints a blank line. Based on my understanding, the code is being executed locally before it reaches the server because

How to elegantly escape single and double quotes when passing C# string to javascript [duplicate]

本小妞迷上赌 提交于 2019-12-08 08:15:30
问题 This question already has answers here : Escaping a double-quote in inline c# script within javascript (3 answers) Closed 5 years ago . I have a C# string that needs to be passed to the page and then sent back to the server. It needs to be able to handle single quotes, double quotes and any other standard characters that might cause problems. I'm using MVC4 and razor. Right now I'm passing the string to javascript. I have something like this: var str = '@Html.Raw(Model.SomeString.Replace("'",

Bash script quote issues

倾然丶 夕夏残阳落幕 提交于 2019-12-08 07:53:13
问题 I have the following Bash script: DIR="~/Folder/With\ Spaces" CMD="find $DIR -type f" # echo showing hidden characters echo $CMD | cat -v while read line do echo $line done < <($CMD) The output: find ~/Folder/With\ Spaces -type f find: ~/Folder/With\: No such file or directory find: Spaces: No such file or directory I've gone through this every way I can think of, with single and double quotes, backslash and no backslash, quotes around the variable in the other lines, no dice. If I understand

Switching from regex literals to RegExp constructor

一笑奈何 提交于 2019-12-08 06:22:25
问题 I'm trying to make a JS function that select all the words beginning with a variable word (3 or 4 letters), and then bold them. I found a suitable regex here but when I try to tweak it (particularly when I use new RegExp ), it doesn't work anymore. A JSfiddle is here. Thanks for your help! Here is the HTML code: <div id="text1">#hallo, this is a test #john #doe with myWordOfTheYear</div> <input type="text" id="input1" onkeyup="searchC(this.value);searchD(this.value);" size="100"/> <br />

node-mysql Using array in query

孤者浪人 提交于 2019-12-08 06:19:31
问题 I'm trying do a query using an array but having a parse error. a - contains an array Ex:[ 7, 26, 87, 65, 86, 23, 63, 69, 44, 61, 8, 79, 47, 88, 15, 17 ] conexao_bd.escape(a) - escaped array Ex: 7, 26, 87, 65, 86, 23, 63, 69, 44, 61, 8, 79, 47, 88, 15, 17 It needs to be in this format (7, 26, 87, 65, 86, 23, 63, 69, 44, 61, 8, 79, 47, 88, 15, 17), so I can use it in the query. Any help how to change format? Code conexao_bd.query("SELECT question, answer FROM ", conexao_bd.escape(tipo) + "

Unescape the chinese characters in url?

南楼画角 提交于 2019-12-08 06:01:44
问题 Sometimes, Chinese characters are escaped into forms like: %B9%F3%D6%DD%C3%A9%CC%A8 How do I convert these back to readable chinese characters in Python? 回答1: You can use urllib2.unquote like this: >>> import urllib2 >>> print urllib2.unquote('%B9%F3%D6%DD%C3%A9%CC%A8').decode('gbk') 贵州茅台 回答2: Try this, urllib.unquote(your_string).decode(your_encoding) 来源: https://stackoverflow.com/questions/13736452/unescape-the-chinese-characters-in-url