escaping

URL encoding with XSLT 1.0

你离开我真会死。 提交于 2019-12-01 18:03:24
I have a problem writing my XSL. I have a link with the following code: <a> <xsl:attribute name="href"> <xsl:value-of select="concat($myUrl,'&projectNumber=',$projectNumber)"/> </xsl:attribute> <xsl:attribute name="title"> <xsl:value-of select="title"/> </xsl:attribute> LINK </a> So I need to pass a variable projectNumber to the end of myUrl . This works just fine and I get ...myUrl...&projectNumber=...projectNumber... in HTML. The problem is, that the variable projectNumber sometimes has some characters which have to be escaped in the href of my link. I tried using the XSL function str:escape

How can I escape variables sent to the 'system' command in C++?

南楼画角 提交于 2019-12-01 17:47:36
问题 This question talks about using the system command and passing variables. Here is an example it gives: string cmd("curl -b cookie.txt -d test="); cmd += line; cmd += " http://example.com"; system(cmd.c_str()); One of the comments mentions that if line was passed and contained foo & fire_nukes.exe & REM then it's quite possible something bad could happen. PHP has a great function called escape_shell_args which can be used to escape parameters that are being passed to the program. Does C++ have

How to decode a reserved escape character in a request URI on a web server?

亡梦爱人 提交于 2019-12-01 17:45:01
问题 It is pretty clear that a web server has to decode any escaped unreserved character (such as alphanums, etc.) to do the URI comparison. For example, http://www.example.com/~user/index.htm shall be identical to http://www.example.com/%7Euser/index.htm . My question is, what are we gonna do with the escaped reserved characters? An example would be %2F , or / . If there is an %2F in the request URI, should the parser of web server replace it with a / ? In the above example, it would mean that

How can I remove escape characters using PHP?

↘锁芯ラ 提交于 2019-12-01 17:44:26
I have the following text $text = "\\vct=140\\Araignée du soir espoir,araignée du matin,espoir du matin." I want to remove the escape characters using php..I do not want to use stripslashes since it is server dependent.. I want to remove the '\' before the '\vct=140' and the '\' before '\Arai....' How can I remove them from the string? As far as I can tell stripslashes works as per the manual : <?php $string = '\\\\vct=140\\\\Araignée du soir espoir.'; echo $string, "\n"; echo stripslashes($string), "\n"; Which outputs: \\vct=140\\Araignée du soir espoir. \vct=140\Araignée du soir espoir.

Java - Forward Slash Escape Character

此生再无相见时 提交于 2019-12-01 17:41:16
问题 Can anybody tell me how I use a forward slash escape character in Java. I know backward slash is \ \ but I've tried \ / and / / with no luck! Here is my code:- public boolean checkDate(String dateToCheck) { if(dateToCheck.matches("[0-9][0-9]\ /[0-9][0-9]\ /[0-9][0-9][0-9][0-9]")) { return true; } // end if. return false; } // end method. Thanks in advance! 回答1: You don't need to escape forward slashes either in Java as a language or in regular expressions. Also note that blocks like this: if

simplejson.loads() get Invalid \\escape: 'x'

半腔热情 提交于 2019-12-01 17:26:25
I am learning how to use simplejson to decode JSON file. But I suffered the "invalid \escape" error. Here is the code import simplejson as json def main(): json.loads(r'{"test":"\x27"}') if __name__ == '__main__': main() And here is the error message Traceback (most recent call last): File "hello_world.py", line 7, in <module> main() File "hello_world.py", line 4, in main json.loads(r'{"test":"\x27"}') File "C:\Users\zhangkai\python\simplejson\__init__.py", line 307, in loads return _default_decoder.decode(s) File "C:\Users\zhangkai\python\simplejson\decoder.py", line 335, in decode obj, end =

Why do Java octal escapes only go up to 255?

落花浮王杯 提交于 2019-12-01 17:18:45
The Java language specification states that the escapes inside strings are the "normal" C ones like \n and \t , but they also specify octal escapes from \0 to \377 . Specifically, the JLS states: OctalEscape: \ OctalDigit \ OctalDigit OctalDigit \ ZeroToThree OctalDigit OctalDigit OctalDigit: one of 0 1 2 3 4 5 6 7 ZeroToThree: one of 0 1 2 3 meaning that something like \4715 is illegal, despite it being within the range of a Java character (since Java characters are not bytes). Why does Java have this arbitrary restriction? How are you meant to specify octal codes for characters beyond 255?

Un-escape JavaScript escaped value in Java

可紊 提交于 2019-12-01 17:18:37
问题 In our web service we set a cookie through JavaScript wich we read again in Java (Servlet) However we need to escape the value of the cookie because it may contain illegal characters such as '&' which messes up the cookie. Is there a transparent way to escape (JavaScript) and unescape again (Java) for this? 回答1: In java you got StringEscapeUtils from Commons Lang to escape/unescape. In Javascript you escape through encodeURIComponent, but I think the Commons component I gave to you will

CKEditor and escaping elements

北慕城南 提交于 2019-12-01 17:16:45
问题 I've using CKEditor for updating CMS content on my website. I also using FontAwesome, which includes set of fancy icons, that can be displayed like this <i class="icon-envelope"></i> The problem is that CKEditor escapes this i tag on client side, and I can't see it in source mode. How I can allow this tag? I have tried CONFIG.removeFormatTags = '' , but it dies not help. 回答1: It is removed because it is empty. Put some non-breaking space   or zero-width space ​ within it to preserve your tag.

How to escape special characters in the key of properties file?

允我心安 提交于 2019-12-01 17:11:36
问题 I've got a key = value property in the .properties file: give names: (1) code = xxx ... but when I tried to get that key, it threw an error: No message found under code give names: (1) code = xxx I tried escaping the whitespace with \ but it didn't work. Do I need to escape : , ( , and ) characters as well? 回答1: You could check out: http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.Reader) For info on how java interprets a properties file. The most relevant part