escaping

Keep XML entities in output (jSoup)

陌路散爱 提交于 2019-12-24 01:45:28
问题 I'm using jsoup to do some xml processing. Problem is, it is replacing xml entities, ie.: » with html entities: » How could I keep original (xml) entities? Groovy script: import org.jsoup.Jsoup import org.jsoup.nodes.Document import org.jsoup.nodes.Entities import org.jsoup.parser.Parser String HTML_STRING = ''' <html> <div></div> <div>Some text »</div> </html> ''' Document doc = Jsoup.parse(new ByteArrayInputStream(HTML_STRING.getBytes("UTF-8")), "UTF-8", "", Parser.xmlParser()) doc

template url reversal escaping surt arguments

你说的曾经没有我的故事 提交于 2019-12-24 01:08:15
问题 I'm having an issue where the template url reversal is escaping colon and parenthetical characters. I want these characters to remain unescaped in the anchor tag's href attribute. It used to behave this way when I was in django 1.3, but upgrading to 1.6, I notice that this does not behave as I want. What I have: surt = 'http://(gov/' browse_domain = 'gov' ... in template ... <a href="{% url 'nomination.views.url_surt' project.project_slug surt %}">{{ browse_domain }}</a> This yields: <a href=

Struts 2 textfield convert apostrophe to “&#39 ;”

♀尐吖头ヾ 提交于 2019-12-24 00:46:30
问题 I am trying to populate name text field with already saved value. Now the value can contain apostrophe. But text fields is converting apostrophe to " &#39 ; ". Eg. sdsd'sds ==> sdsd&#39 ;sds escape property for textfield is not working. What should I do? 回答1: You are getting this because of Encoding feature. To avoid this and get exactly same as you want, you have to use HtmlDecode which is available in util package of java. 回答2: You are probably escaping it server-side. Don't. Struts will

Is there a way to make TFS code search recognize the “@” symbol?

*爱你&永不变心* 提交于 2019-12-24 00:37:05
问题 I am searching for all occurrences of an out of date email domain in my codebase on TFS. Specifically, I am searching for "@testexample.com". However, the search seems to completely ignore the "@" symbol. If I search "@testexample.com", I get all occurrences of "testexample.com". I have also tried "*@testexample.com" but prefix wildcards aren't allowed in code search. 回答1: That's not supported. Checked for some characters in code search. You can't use the symbol characters except * and ? as

Escape string for putting it into regex in TCL

隐身守侯 提交于 2019-12-24 00:34:33
问题 I use Expect as testing framework and write some helper functions to simplify typing of matching patterns for expect command. So I look for function that transform any string into string in which all special regex syntax escaped (like * , | , + , [ and other chars) so I would be able put any string into regex without worrying that I break regex: expect -re "^error: [escape $str](.*)\\." refex "^error: [escape $str](.*)\\." "lookup string..." For expect -ex and expect -gl it is pretty easy to

What is the difference between \“ and ”" in Erlang

萝らか妹 提交于 2019-12-24 00:14:50
问题 In Erlang, \" is an escape character that means double quote. My question is, what is the difference between "\"test\"" and ""test"" ? The reason I ask is because, I'm trying to handle a list_to_atom error: > list_to_atom("\"test\""). '"test"' > list_to_atom(""test""). * 1: syntax error before: test 回答1: "" is a string/list of length 0 \" is just an escaped double-quote when used in the context of a string. If you wanted to have a string that consists of just a double-quote (ie \" ), then you

HTML tags within JSON (in Python)

这一生的挚爱 提交于 2019-12-23 22:26:00
问题 I understand its not a desirable circumstance, however if I NEEDED to have some kind of HTML within JSON tags, e.g.: { "node": { "list":"<ul><li class="lists">Hello World</li><ul>" } } is this possible to do in Python without requiring to to be escaped beforehand? It will be a string initially so I was thinking about writing a regular expression to attempt to match and escape these prior to processing, but I just want to make sure there isn't an easier way. 回答1: Well, depending on how varied

bash script - unable to set variable with double quotes in value

China☆狼群 提交于 2019-12-23 20:42:37
问题 Need help in fixing this bash script to set a variable with a value including double quotes. Somehow I am defining this incorrectly as my values foo and bar are not enclosed in double quotes as needed. My script thus far: #!/usr/local/bin/bash set -e set -x host='127.0.0.1' db='mydev' _account="foo" _profile="bar" _version=$1 _mongo=$(which mongo); exp="db.profile_versions_20170420.find({account:${_account}, profile:${_profile}, version:${_version}}).pretty();"; ${_mongo} ${host}/${db} --eval

Escape " character in php with echo

末鹿安然 提交于 2019-12-23 20:05:05
问题 Short question: echo '<button type="button" id="add" onClick="addAsset('.$filename.');"> '.$filename.' </button>'; this creates a button with an onClick function addAsset(example.png); But i'd like to have addAsset("example.png") how do i escape the " character? Thank you! 回答1: You can try the following instead: echo '<button type="button" id="add" onClick="addAsset(\''.$filename.'\');"> '.$filename.' </button>'; So, instead of escaping " double quote. we are escaping ' single quote. Which

What should an escape character do if the following character doesn't need escaping?

强颜欢笑 提交于 2019-12-23 19:57:36
问题 An application I'm working on has a field where a string can be entered. Special characters in the string cause different things to be inserted when the string is evaluated, but these special characters can be preceded by an escape character (a backslash) which cause the special character to be output literally rather than its special meaning. Think of it as similar to a regular expression: . matches any character but \. matches a dot. What is the most intuitive thing to happen when the