escaping

How to use ESC () character in XML?

倖福魔咒の 提交于 2019-11-29 15:17:15
I'm trying this: <root> text: &#27; </root> But parser says: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 12; Character reference "&#27" is an invalid XML character. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) How to use it there? You cannot ( in XML 1.0) . In XML 1.1 there is a slightly larger range of characters you can use, and the characters are expressed differently , but even then, &#27; is 'restricted' (hex it is &#x1B;

How to use both single and double quotes inside JSTL/EL expression?

拜拜、爱过 提交于 2019-11-29 14:34:57
I want to call fn:replace inside EL inside c:out to replace quote caracters. The following does not work <c:out value="${fn:replace(userName,'"','\\"')}"/> because XML parser stops at first double quote and sees no c:cout tag termination (JSP compilation stage error). The following <c:out value="${fn:replace(userName,'"','\\"')}"/> does not work, probably because replace function does not see actual quote character. BalusC Parameterize them with <c:set> . <c:set var="search" value='"' /> <c:set var="replace" value='\\"' /> <c:out value="${fn:replace(userName, search, replace)}"/> Unrelated to

URL Escaping Chinese/Japanese Unicode Characters for Internet Explorer

匆匆过客 提交于 2019-11-29 14:10:21
问题 I'm trying to URL-escape (percent-encode) non-ascii characters in several URLs I'm dealing with. I'm working with a flash application that loads resources like images and sound clips from these URLs. Since the filenames can contain non-ascii characters, like so: 日本語.jpg I escape them by utf-8 encoding the characters, and then percent-escaping the unicode bytes, to get the following: %E6%97%A5%E6%9C%AC%E8%AA%9E.jpg These filenames work fine when I run the app in any browser other than Internet

How do you get your Fulltext boolean search to pick up the term C++?

帅比萌擦擦* 提交于 2019-11-29 14:08:29
问题 So, I need to find out how to do a fulltext boolean search on a MySQL database to return a record containg the term "C++". I have my SQL search string as: SELECT * FROM mytable WHERE MATCH (field1, field2, field3) AGAINST ("C++" IN BOOLEAN MODE) Although all of my fields contain the string C++, it is never returned in the search results. How can I modify MySQL to accommodate this? Is it possible? The only solution I have found would be to escape the + character during the process of entering

PHP function to escape MySQL regexp syntax

佐手、 提交于 2019-11-29 13:17:09
I'm looking for something similar to preg_quote, but for the MySQL regexp syntax. Any ideas? MySQL regexps are the ‘extended’ POSIX variant (ERE), available in PHP as the deprecated ereg_ functions. Unfortunately there is no ereg_quote in PHP, however PCRE's special characters are a superset of ERE's special characters, and backslash-escaping a non-special punctuation character doesn't harm it, so you can get away with using preg_quote safely. (Naturally you will need parameterised queries or mysql_real_escape_string after that quoting, to stop the backslashes being misinterpreted as MySQL's

Using left double quotation marks in strings in VB

这一生的挚爱 提交于 2019-11-29 13:09:46
In following code, the usage of the string "“" (i.e. a left double quotation mark inside a string) results in a compile error in VB.NET: StringVar = Replace(StringVar, "“", "“") What’s going on here? It seems as if you want to replace curly quotes with their HTML code equivalent. On the first glance, your code is absolutely correct. The problem is that VB allows curly quotes in place of regular quotes in code (because Unicode is great, right?). That is, the following codes are all equivalent: Dim str = "hello" Dim str = “hello” Dim str = "hello“ Now, if you want to use a quotation mark inside

Replacing “#”, “$”, “%”, “&”, and “_” with “\#”, “\$”, “\%”, “\&”, and “\_”

断了今生、忘了曾经 提交于 2019-11-29 12:27:55
问题 I have a plain text document, which I want to compile inside LaTeX. However, sometimes it has the characters, "#", "$", "%", "&", and "_". To compile properly in LaTeX, I must first replace these characters with "#", "\$", "\%", "\&", and "_". I have used this line in sed : sed -i 's/\#/\\\#/g' ./file.txt sed -i 's/\$/\\\$/g' ./file.txt sed -i 's/\%/\\\%/g' ./file.txt sed -i 's/\&/\\\&/g' ./file.txt sed -i 's/\_/\\\_/g' ./file.txt Is this correct? Unfortunately, the file is too large to open

sed, foward slash in quotes

若如初见. 提交于 2019-11-29 12:25:10
I'm trying to do something in bash with sed that is proving to be extremely difficult. I have a bash script that takes as its first argument a date. The code want to change a line in a text file to include the passed date. Here's the code #!/bin/bash cq_fname="%let outputfile="/user/cq_"$1".csv";" sed "29s/.*/\"$ct_fname\"/" file1.sas > file2.sas This script fails on the third line, I get something about a garbled command. Does anybody know a clever way to get this to work? How can I get a forward slash in quotes in sed ? You can use any character in place of the / , so just pick one that is

PHP regex : split on unescaped delimiter

我的未来我决定 提交于 2019-11-29 12:14:16
I am able to split strings in the format key:value; using the following code: $inside = "key1:value1;key2:value2;key3:value3;"; preg_match_all("/([^:]+):([^;]+);/s", $inside, $pairs); What I would like to do is allow for the occurrence of the colon and semi-colon character in the values by introducing an escape character e.g. \; any colon or semi-colon immediately preceded by a backslash would be ignored. Bonus points if within the same regex, the escaped characters can then be stored in the array of matches unescaped without having to run everything through str_replace . Thanks for any help

XSL: Include some ASCII control chars when method=“text”

别等时光非礼了梦想. 提交于 2019-11-29 11:54:53
I've got an XSL template that outputs text as opposed to XML. In this text, I need to include ASCII character 0x10 in certain position. I understand this character is not allowed in an XML document, but I'm going to output text, so why am I not allowed to use it anyway? I also understand it will not be possible to put this character literally into the template, neither within a CDATA section nor as &#16; . But why does on-the-fly generation not work either? I tried, for instance, to define a function that returns this char and used it as <xsl:value-of select="z:get_char(16)"/> but that