escaping

Escape \u200b (Zero width space) and other illegal JavaScript characters

一个人想着一个人 提交于 2019-12-11 03:45:14
问题 I have a set of JavaScript objects I bootstrap to a backend template to initialise my Backbone.js collections on page load. It looks something like this (as Twig template): <script type="text/javascript"> (function() { var jobCollection = new App.Collections.Item( {% for item in items %} { name: '{{ item.name }}', ... }, {% endfor %} ); })(); </script> The problem I'm having is that some text fields contain \u200b (Zero width space) that break the JavaScript. What is the best way to escape

Replace HTML entities (e.g. ’) with character equivalents when parsing an XML feed

久未见 提交于 2019-12-11 03:40:46
问题 When parsing an XML feed, I am getting text from the content tag, like this: The Government has awarded funding for a major refurbishment project to go ahead at St Eunan’s College. This is in addition to last month’s announcement that grant for its prefabs to be replaced with permanent accomodation. The latest grant will allow for major refurbishment to a section of the school to allow for new accommodation for classes – the project will also involve roof repairs, the installation of a dust

Can I escape double quotes in column titles with Oracle?

自闭症网瘾萝莉.ら 提交于 2019-12-11 03:13:54
问题 Creating a table with a double quote to escape the real double quote doesn't seem to work in Oracle's SQL syntax: CREATE TABLE "MyTable" ( "Col""umn 1" varchar(168) ); The above fails. Is there any way to escape the double quote to make 'Col"umn 1'? 回答1: You can not. According to the documentation: Nonquoted identifiers can contain only alphanumeric characters from your database character set and the underscore (_), dollar sign ($), and pound sign (#). Database links can also contain periods

Escaping single quotes in shell for postgresql

匆匆过客 提交于 2019-12-11 03:05:25
问题 Im trying execute sql through psql under postgres account. Im able run sql that doesnt contain quotes root@server:/home/rosta/SCRIPTS# su postgres -c "psql -c 'SELECT NOW()'" now ------------------------------- 2014-06-07 09:38:17.120368+02 (1 row) Problem appears with sql query that contains quotes like SELECT 'hi'. Im testing with simple 'hi', but I would like execute something like this from shell script. su postgres -c "psql -c 'create database $DB_NAME template=template0 encoding='utf8'

How do I display html within html?

我的未来我决定 提交于 2019-12-11 02:55:53
问题 Suppose I've got an html document: <html>test<html> And I want to display that code in a browser. Then I'd create something like: <html><body> <pre><html>test<html></pre> </body></html> To make the gubbins in the middle I have a function: (defn html-escape [string] (str "<pre>" (clojure.string/escape string {\< "<", \> ">"}) "</pre>")) which does the above transformation for me: user> (html-escape "<html>test<html>") "<pre><html>test<html></pre>" My question is: is that good enough, or am I

Use double quote then curly brace in powershell -Command

爷,独闯天下 提交于 2019-12-11 02:42:32
问题 There are a couple questions related to this on here but they specifically address Write-Host. I want to run something like powershell.exe -Command "'example.exe' /f`"`{GUID`}`"" Only it fails with the error Missing closing '}' in statement block. At line:1 char:396 + $mypid=(get-process EXEName*).id;wait-process -id $mypid; & `C:\Users\User\AppData\Local\Temp\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\Target.exe` /s /ig``{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX`}` /instance=1 /f3`C:\Recordings` /f4

How to escape quote PHP strings generated by Delphi?

天涯浪子 提交于 2019-12-11 02:42:19
问题 My code is littered with things like this Write (thePhpFile, ' echo "<option value=\"' + theControl.Name + '_selection\">" . $' + theControl.Name + '_values[$_POST["' + theControl.Name + '_selection"]];'); which genrates the following PHP code echo "<option value=\"ComboBox1_selection\">" . $ComboBox1_values[$_POST["ComboBox1_selection"]];?> Surely there's a better way to handle this? Maybe a Delphi function which I can pass the desired PHP string and have it double up quotes where necessary?

Should &'s be escaped in onclick=“…”?

最后都变了- 提交于 2019-12-11 02:35:44
问题 I haven't found a proper answer for this yet: Should & (ampersand) be escaped in onclick="..." ? (Or for that matter, in every HTML attribute?) I have tried running both escaped and unescaped tests on jsFiddle and W3C's validator, both are working... http://jsfiddle.net/6LuES <div onclick="if (1==1 && 2==2) alert('hello there');">Without escape</div> <div onclick="if (1==1 && 2==2) alert('hello there');">With escape</div> http://validator.w3.org/#validate_by_input <!DOCTYPE html> <html lang=

Java library to escape/clean XML?

大城市里の小女人 提交于 2019-12-11 02:29:54
问题 I get some malformed xml text input like: "<Tag>something</Tag> 8 > 3, 2 < 3, ... <Tag>something</Tag>" I want to clean the input so to get: "<Tag>something</Tag> 8 > 3, 2 < 3, ... <Tag>something</Tag>" That is, escape those special symbols like <,> and yet keep the valid tags (" <Tag>something</Tag> , note, with the same case) Do you know of any java library to do this? Probably a xml/html parser? (though I don't really need a parser, simple a "clean" procedure) 回答1: JTidy is "HTML syntax

Escape Left Bracket C# Regex

自作多情 提交于 2019-12-11 02:08:54
问题 I have a string in the following format: prm.Add( "blah", "blah" ); I am looking to use regex to extract the first "blah". To do this I am carving the front half off and then the back half. The regex I'm using to get rid of "prm.Add( " is: "prm.Add\([ ]*" Other threads seem to indicate that escape characters before paranthesis would be acceptable. However VS complains that I have an invalid escape charcter sequence "(". If I use: "prm.Add([ ]*" The application errors as there is no closing