escaping

How to parameterize an ALTER ROLE statement in Postgresql?

梦想的初衷 提交于 2020-01-14 22:40:47
问题 I'm trying to make a PHP interface to my PSQL database, and I would like a few local users registered on PSQL to log into my DB. I would first create each username for each user, with a generic password like 'Password123', and then the user could latter change his/her password. To do that, I thought of using a simple PHP form: <form action="" method="post"> <table> <tr> <td> User: </td> <td> <input type="text" name="user" /> </td> </tr> <tr> <td> Old password: </td> <td> <input type="password

Is it possible to use the space character in CSS class names?

馋奶兔 提交于 2020-01-14 10:32:27
问题 I have a case with computer-generated class names where it could be that the class name might contain a space character (I don't have direct control over the IDs that are turned into class names). I figured out how to escape all characters in CSS (see the excellent answers in Which characters are valid in CSS class names/selectors? and http://mathiasbynens.be/notes/css-escapes). But I didn't manage to get a space character escaped in a CSS class name in the HTML code. I now used a solution

Is > ever necessary?

旧巷老猫 提交于 2020-01-14 07:18:48
问题 I now develop websites and XML interfaces since 7 years, and never, ever came in a situation, where it was really necessary to use the > for a > . All disambiguition could so far be handled by quoting < , & , " and ' alone. Has anyone ever been in a situation (related to, e.g., SGML processing, browser issues, XSLT, ...) where you found it indespensable to escape the greater-than sign with > ? Update: I just checked with the XML spec, where it says, for example, about character data in

Back slash causing problems c++

大兔子大兔子 提交于 2020-01-14 04:56:07
问题 I'm trying to use back slash in C++ in a string like this : HWND hwnd = FindWindowA(NULL, "C:\Example\App.exe"); So for this example I would get these errors/warnings :"unknown escape sequence: '\E'" "unknown escape sequence: '\A'" . Since I need to type in the exact name of the window , is there any way to avoid using back slashes or stop the compiler from interpreting them as "escape sequences" ? 回答1: You have to escape them properly, C++11 added raw string which eases this thing: HWND hwnd

Converting characters to their python escape sequences

倖福魔咒の 提交于 2020-01-13 18:37:05
问题 Is it possible to take a string, and convert all the characters into their Python escape sequences? 回答1: Supports full escaping of both str and unicode (now produces the shortest escape sequence): def escape(s): ch = (ord(c) for c in s) return ''.join(('\\x%02x' % c) if c <= 255 else ('\\u%04x' % c) for c in ch) for text in (u'\u2018\u2019hello there\u201c\u201d', 'hello there'): esc = escape(text) print esc # code below is to verify by round-tripping import ast assert text == ast.literal

Escape a string (add slashes) in VB.net?

放肆的年华 提交于 2020-01-13 08:16:09
问题 Very simple question (surprisingly I can't find a similar question anywhere): how do I escape form data in VB.net? I have various lines like this: Dim query As String = "exec sp_Message_insert @clientid='" + pClientId + "', @message='" + pMessage + "', @takenby='" + pUserId + "', @recipients='" + pRecipients + "'" If I use an apostrophe in the message then of course this screws up the query. I've looked through the intellisense functions on the string but don't see anything appropriate... 回答1

Escape a string (add slashes) in VB.net?

余生颓废 提交于 2020-01-13 08:15:06
问题 Very simple question (surprisingly I can't find a similar question anywhere): how do I escape form data in VB.net? I have various lines like this: Dim query As String = "exec sp_Message_insert @clientid='" + pClientId + "', @message='" + pMessage + "', @takenby='" + pUserId + "', @recipients='" + pRecipients + "'" If I use an apostrophe in the message then of course this screws up the query. I've looked through the intellisense functions on the string but don't see anything appropriate... 回答1

Django. Use url tags inside quotes, inside quotes

筅森魡賤 提交于 2020-01-12 10:38:31
问题 I want to pass this variable to the context and render it, it includes html tags. notificacion_string = "<a href = \"{% url \'perfiles:perfil\' actor.usuario.username \'recientes\' %}\" > %s </a> voted on your post" % (notificacion.actor.usuario.username) As you can see, I have tried escaping the quotes inside the href=" ". But I get this error: %u format: a number is required, not unicode So, I guess the error happens when "% url .." %() is evaluated. I have tried many things without success

PSQLException: ERROR: syntax error in tsquery

北战南征 提交于 2020-01-12 04:33:06
问题 Which characters must be avoided to make sure PSQLException: ERROR: syntax error in tsquery will not occur? The documentation does not say anything about how to escape the search string: http://www.postgresql.org/docs/8.3/static/datatype-textsearch.html 回答1: Use quotes around your terms if you want them as phrases/verbatim or they contain characters used in the syntax: select to_tsquery('"hello there" | hi'); Bare in mind that you shouldn't really have crazy characters in your terms, since

Using a BackSlash in Java [duplicate]

為{幸葍}努か 提交于 2020-01-11 12:53:09
问题 This question already has answers here : What is the backslash character (\\)? (6 answers) Closed 4 years ago . I want to print out a backslash. However, I get an error: //Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) System.out.println("\"); 回答1: System.out.println("\\"); \ will escape the second \ character. 来源: https://stackoverflow.com/questions/30781026/using-a-backslash-in-java