How to handle a single quote in Oracle SQL
Use two single-quotes SQL> SELECT ‘D”COSTA’ name FROM DUAL; NAME ——- D’COSTA Alternatively, use the new (10g+) quoting method: SQL> SELECT q’$D’COSTA$’ NAME FROM DUAL; NAME ——- D’COSTA
Use two single-quotes SQL> SELECT ‘D”COSTA’ name FROM DUAL; NAME ——- D’COSTA Alternatively, use the new (10g+) quoting method: SQL> SELECT q’$D’COSTA$’ NAME FROM DUAL; NAME ——- D’COSTA
With the help of bucabay and the advice to create my own function i created this one which works for me. What do you guys think, is there a better solution somewhere? if(typeof escapeHtmlEntities == ‘undefined’) { escapeHtmlEntities = function (text) { return text.replace(/[\u00A0-\u2666<>\&]/g, function(c) { return ‘&’ + (escapeHtmlEntities.entityTable[c.charCodeAt(0)] || ‘#’+c.charCodeAt(0)) + ‘;’; }); … Read more
Use 2 quotes: “Samsung U600 24″””
No, and I’ve always been annoyed by the lack of different string-literal syntaxes in Java. Here’s a trick I’ve used from time to time: String myString = “using `backticks` instead of quotes”.replace(‘`’, ‘”‘); I mainly only do something like that for a static field. Since it’s static the string-replace code gets called once, upon initialization … Read more
Quote sed codes with double quotes: $ sed “s/ones/one’s/”<<<“ones thing” one’s thing I don’t like escaping codes with hundreds of backslashes – hurts my eyes. Usually I do in this way: $ sed ‘s/ones/one\x27s/'<<<“ones thing” one’s thing
As dbhenham points out in this comment, a (MUCH) more detailed answer can be found in portions of this answer (originally by another user jeb and significantly edited and updated by dbhenham since) on a related but much more general question: parsing – How does the Windows Command Interpreter (CMD.EXE) parse scripts? – Stack Overflow … Read more
The escape character in batch scripts is ^. But for double-quoted strings, double up the quotes: “string with an embedded “” character”
You’ll have to use unicode_escape instead: >>> b”\\123omething special”.decode(‘unicode_escape’) If you start with a str object instead (equivalent to the python 2.7 unicode) you’ll need to encode to bytes first, then decode with unicode_escape. If you need bytes as end result, you’ll have to encode again to a suitable encoding (.encode(‘latin1’) for example, if you … Read more
addslashes() isn’t fully adequate, but PHP’s mssql package doesn’t provide any decent alternative. The ugly but fully general solution is encoding the data as a hex bytestring, i.e. $unpacked = unpack(‘H*hex’, $data); mssql_query(‘ INSERT INTO sometable (somecolumn) VALUES (0x’ . $unpacked[‘hex’] . ‘) ‘); Abstracted, that would be: function mssql_escape($data) { if(is_numeric($data)) return $data; $unpacked … Read more
LIKE ‘WC[[]R]S123456’ or LIKE ‘WC\[R]S123456’ ESCAPE ‘\’ Should work.