escaping

Escape double quote in sybase

守給你的承諾、 提交于 2019-12-12 03:56:46
问题 I am running a query on a database to retrieve records in a CSV (with quotes) format: "Data","More data","some "funny" data with quotes","more" . Now when this is parsed, there is an obvious problem with this bit: ...,"some "funny" data with quotes",... Is there a way to "escape" these quotes in sybase to save me post-processing? 回答1: if it's just double-quote you want to select in a literal string, use single quote as the string's delimiter. Try select '"' and you'll see 回答2: --after you

how combine 'utf-8' and 'unicode_escape' to correctly decode b'\xc3\xa4\\n-\\t-\\“foo\\”'?

谁说胖子不能爱 提交于 2019-12-12 03:29:47
问题 I have a library that gives me encoded and escaped byte sequences like this one: a=b'\xc3\xa4\\n-\\t-\\"foo\\"' Which I want to translate back to: ä - -"foo" I tried to just .decode a which decodes the sequence as wanted: >>> a.decode() 'ä\\n-\\t-\\"foo\\"' But it does not un-escape. Then I found 'unicode_escape' and I got >>> print(a.decode('unicode_escape')) ä - -"foo" Is there a way to decode and unescape the given sequence with a builtin method (i.e. without having to .replace('\\n', '\n

Is my escape function really safe? [duplicate]

拜拜、爱过 提交于 2019-12-12 03:07:33
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Best way to stop SQL Injection in PHP The ultimate clean/secure function My website was attacked via sql injection and now I need to improve it. I'm creating a function in PHP escape() , that returns the escaped version of a string. I'm not a hacker so please help me to improve my escape function. Here is the current version: function escape($string){ $string = stripslashes($string); $string = mysql_real_escape

encodeURIComponent or Escape in VB6

落花浮王杯 提交于 2019-12-12 02:58:38
问题 Is there a encodeURIComponent or Uri.EscapeDataString in VBScript that can be used in an classic ASP page? I need this function to generate jQuery parseable XML. Server.HTMLEncode does not do a complete job. 回答1: You can just escape the characters yourself if you would like, according to this link, there are only five: What characters do I need to escape in XML documents? Therefore, something like this should work: //usage EncodedXML = XMLEncode(MyDecodedXML) //function Function XMLEncode(str

How to write php within html within php?

旧街凉风 提交于 2019-12-12 02:55:01
问题 I have recently asked this question, but rather than getting a direct answer, I was shown how to use the ternary operator to simplify my code by substituting if statements inside my html with variables, which I appreciated and put to use - however that also caused other code to be harder to read and ultimately did not teach me to properly escape/parse php in code similar to that below. So I would love a simple 'show and tell' of how to make the following code parse, thank you: <?php if (

php no good escape

一世执手 提交于 2019-12-12 02:14:44
问题 I have a script like this: document.getElementById('debugLayer').innerHTML = '<?php foreach (self::$errorLogs as $item) { echo htmlentities ($item, ENT_QUOTES).'<hr />'; } ?>'; where $errorLogs is an array of list. But it must have not escape correctly, since firefox say to this: Error: malformed Unicode character escape sequence Source File: X Line: 553, Column: 63 Source Code: document.getElementById('debugLayerDIVcontent_10').innerHTML = '<span style="background-color:yellow;"><i>Missing

gsp, groovy, encodeURI component, inline javascript

被刻印的时光 ゝ 提交于 2019-12-12 01:02:17
问题 i have a problem with this each loop i have a select, you choose an option, press a button and the selected value is beamed via ajax as encodeURIcomponent to the backend, the answer updates this ul : <g:each in="${items}"> <li class="${fieldName}_item" >${it}<span onclick="deleteItem('${fieldName}','${id}','${reloadForm}', '${it}');" class="editdropdel ${fieldName}_button"></span></li> </g:each> as soon as ${it} contains special characters like " "" " the inline stuff is broken, is there

When I escape all the input, sometimes It leaves slashes (\) in the string and inserts it to database. Why does it happen and how can I solve this?

限于喜欢 提交于 2019-12-12 00:39:58
问题 I have found stripslashes function but I would rather find where I am adding more slashes than I should. My functions use mysql_real_escape_string once for each variable and I am querying database using "insert into foo(bar,bar) values($baz,$baz)" maybe this is the problem. phpinfo gives magic_quotes_gpc On On magic_quotes_runtime Off Off magic_quotes_sybase Off Off static function insert($replyto,$memberid,$postid,$comment) { $message=array(); $lenmax=1000; $lenmin=5; $toolong="comment is

How to escape a backslash that is already escaping a single quote in php?

别说谁变了你拦得住时间么 提交于 2019-12-11 23:16:01
问题 So I have a script that creates a script that can then create another script. See below, I have written (how do I escape this) where I'm not sure what to do. fwrite($file, ' fwrite($file, \' fwrite($file, (how do i escape this)\' (how do i escape this)\' \' '); fclose; I really hope that makes sense to someone! 回答1: To escape a backslash add another one: echo " Escape \\"; 来源: https://stackoverflow.com/questions/35879708/how-to-escape-a-backslash-that-is-already-escaping-a-single-quote-in-php

How to escape accolade characters in CMake

纵然是瞬间 提交于 2019-12-11 21:16:30
问题 I'm manually generating a QtCreator project file (.pro) from CMake. At some point, I need to write $${VAR} to the .pro file. So I need to escape both the $ character and the { } . I found out how to protect the $ sign, here is how I proceed: macro( QMAKE_ADD_LINE_TO_VAR var line ) set( ${var} "${${var}}\n${line}\n" ) endmacro() set(PRO_CONTENT "#Generated by CMake scripts!") # Adding many other stuff here.... QMAKE_ADD_LINE_TO_VAR(PRO_CONTENT "TARGET = \\$\\$VAR" ) file(WRITE file.pro ${PRO