ampersand

Use ampersand in CAST in SQL

我的梦境 提交于 2019-12-06 00:47:26
The following code snippet on SQL server 2005 fails on the ampersand '&': select cast('<name>Spolsky & Atwood</name>' as xml) Does anyone know a workaround? Longer explanation, I need to update some data in an XML column, and I'm using a search & replace type hack by casting the XML value to a varchar, doing the replace and updating the XML column with this cast. select cast('<name>Spolsky & Atwood</name>' as xml) A literal ampersand inside an XML tag is not allowed by the XML standard, and such a document will fail to parse by any XML parser. An XMLSerializer() will output the ampersand HTML

How can I make my xml safe for parsing (when it has & character in it)?

三世轮回 提交于 2019-12-05 14:32:26
I've been given an xml string which I need to put through a parser. Its currently complaining because of an illegal xml character. Very simplified example: <someXml>this & that</someXml> I know that the solution is to replace & with & , but I'm not generating the XML and therefore have no control over the values. A simple string replace is not the right way to to this since the '&' has special meaning in XML and a global replace of '&' with '&' would ruin the special meaning which was intended. Is there a solution to take a full xml document and 'fix' it so that '&' become '&', but only where

Prevent Rails from encoding the ampersands in a URL when outputting JSON

余生长醉 提交于 2019-12-05 12:51:30
问题 I have the following code: render json: { image: image } Image has an attribute "url". Let's say it's: https://blah.com/a?A=B&C=D When rendering, this is what I get: {"image":{"url":"https://blah.com/a?A=B\u0026C=D"}} The ampersand is getting encoded as \u0026 Is there any way to avoid this encoding? 回答1: Add to your application.rb file: config.active_support.escape_html_entities_in_json = false 回答2: your answer described there: Converting URL to JSON version? JSON encoding wrongly escaped

Developing a ribbon tab in Word 2010, using ampersand symbol in group label name

半腔热情 提交于 2019-12-05 12:06:33
I'm developing a ribbon tab for use in a template ( MyTemplate.dotm ) for Word 2010. My problem: I want to have an ampersand symbol (&) in the label for a group. I have tried many things, and also alot of googling about this issue, but nothing works: (named) & (decimal) & (decimal) & (hex) & This is what I have tried, the xml saved in MyTemplate.dotm -file (with Custom UI Editor for Microsoft Office ): <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui"> <ribbon> <tabs> <tab id="tabMyTemplate" label="myTemplate"> <group

php file_get_contents($url) & turns into &

梦想的初衷 提交于 2019-12-05 03:09:55
I am trying to make a request to the coinbase api like this $url = "https://api.gdax.com/products/BTC-USD/candles?start=".date($format,$starting_date)."&end=".date($format,$ending_date)."&granularity=".$granularity; and then I pass that in file_get_contents($url) but it gives me an error file_get_contents( https://api.gdax.com/products/BTC-USD/candles?start=2015-05-07&end=2015-05-08&granularity=900 ): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request. The problem of course is when the '&' gets changed into '&'. Ilgıt Yıldırım It seems you need define an user agent. Try this;

Java String Replace '&' with & but not & to &

旧时模样 提交于 2019-12-04 23:55:35
I have a large String in which I have & characters used available in following patterns - A&B A & B A& B A &B A&B A & B A& B A &B I want to replace all the occurrences of & character to & While replacing this, I also need to make sure that I do not mistakenly convert an & to &amp; . How do I do that in a performance savvy way? Do I use regular expression? If yes, please can you help me to pickup the right regular expression to do the above? I've tried following so far with no joy: data = data.replace(" & ", "&"); // doesn't replace all & data = data.replace("&", "&"); // replaces all &, so &

C++ member function overloading with & (ampersand)

孤街浪徒 提交于 2019-12-04 22:18:48
How to pick the correct error() member function? Do I need to cast somehow? using namespace std; struct test { int error(); void error(int x); int fun(); }; int main() { auto f1 = &test::error; // how to pick the correct function? auto f2 = &test::fun; // works } Do I need to cast somehow? Yes, you can use static_cast . static_cast may also be used to disambiguate function overloads by performing a function-to-pointer conversion to specific type, as in std::transform(s.begin(), s.end(), s.begin(), static_cast<int(*)(int)>(std::toupper)); So you can: auto f1 = static_cast<int(test::*)()>(&test:

How do you use an Ampersand in an HTTPCookie in VB.NET?

落爺英雄遲暮 提交于 2019-12-04 05:24:58
问题 I have a cookie saved to the user as follows... Dim searchCookie As HttpCookie = New HttpCookie("SearchCriteria") searchCookie.Item("SearchText") = FullSearchCriteria.SearchText searchCookie.Item("SearchType") = FullSearchCriteria.SearchType The SearchText stores a value they have input in a previous page. We have observed if there is an ampersand in the cookie (eg Tyne & Wear), then the cookie doesn't save subsequent values (SearchType). What happens is the cookie is output like this:

batch file deal with Ampersand (&) in folder name

眉间皱痕 提交于 2019-12-03 22:34:40
问题 Batch file below: @echo off set filelocation=C:\Users\myself\Documents\This&That cd %filelocation% echo %filelocation% pause give the following output: 'That' is not recognized as an internal or external command, operable program or batch file. The system cannot find the path specified. C:\Users\myself\Documents\This Press any key to continue . . . Considering I cannot change the folder name, how do I handle the "&" 回答1: You need two changes. 1) The extended set syntax with quotes prefix the

SED : How to replace a character within a matched pattern using ampersand (&)

社会主义新天地 提交于 2019-12-03 05:53:16
问题 When we match a pattern using sed, the matched pattern is stored in the "ampersand" (&) variable. IS there a way to replace a character in this matched pattern using the ampersand itself ? For example, if & contains the string "apple1", how can I use & to make the string to "apple2" (i.e replace 1 by 2) ? 回答1: If I guessed right, what you want to do is to apply a subsitution in a pattern matched. You can't do that using & . You want to do this instead: echo apple1 apple3 apple1 apple2 botemo1