ampersand

LibXML2 Sax Parsing and ampersand

I've encountered (what I think is) a strange behavior when using the sax parser, and I wanted to know if it's normal. I'm sending this XML through the SAX parser: The "& a m p ;" gets converted to " & # 3 8 ;" when the startElement callback is called. Is it supposed to do that? If so, I would like to understand why. I've pasted an...

Does this line declare a function? C++

Hi all, I was reading litb's question about SFINAE here and I was wondering exactly what his code is declaring. A simpler (without the templates) example is below: int (&a())[2]; What exactly is that declaring? What is the role of the &? To add to my confusion, if I declare the following instead int b()[2]; I get an error about dec...

Why can't RSS handle the Ampersand?

This is something I've been wondering for a while now. I'll occasionally come across an RSS feed that is broken, and blown to pieces all because line 23 say "Sanford & Sons." The most confusing thing is the fact that if you convert the & into &, all is well, even though your alternative still contains the problem-char! Please somebo...

Use ampersand in CAST in SQL

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 ...

sizeWithFont - weird behavior when containing the & character

Whenever an & is present on the text, getting the height seems to be off all the time. Both functions return less than the actual height: CGSize labelSize = [nameLabel.text sizeWithFont:nameLabel.font constrainedToSize: CGSizeMake( actualWidth, MAXFLOAT ) lineBreakMode:UILineBreakModeWordWrap]; CGRect textSize = CGRectMake(0.0, 0.0, 32...

mod_rewrite replace all instances of ampersand with %26 for later

Hey there! I want to simply not use ampersand in my URL so I can pass ampersands further down into my system when a file is requested. The problem is Apache deals with it differently. I don't know how I already rewrite the requested file to index.php?url=$1 so I can see what it was, but if it has an ampersand in there, it can't continu...

How do I make Firefox open a file with an ampersand in the filename?

I've written some Ruby code to inspect ZIP-files as part of an internal company process. The way we usually launch this code is from a web browser. When you click to download the file, you select "open with" and specify the full path to a small batch file. This one-line batch file looks like this: \\mathworks\public\Matthew_Simoneau\...

What is the second meaning of a single ampersand in C#?

I have used the single ampersand (&) in C# to mean "check the second conditional statement even if the first is false". But the following seems to be a different meaning of & altogether, can anyone explain how i & 1 works in the following example? List<int> scores = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 }; var evenScores = scores.Whe...

URL and the ampersand

Using XSLT and XPath 1.0, I have a string I want to escape for use on a URL, for example: <description>one word &amp; another</description> So, the text() of the description element should get URL escaped. How would I do this? Using C# (XslCompiledTransform) the code would be: string a = Server.UrlEncode("one word & another"); An...

What does it mean to start a PHP function with an ampersand?

I'm using the Facebook library with this code in it: class FacebookRestClient { ... public function &users_hasAppPermission($ext_perm, $uid=null) { return $this->call_method('facebook.users.hasAppPermission', array('ext_perm' => $ext_perm, 'uid' => $uid)); } ... } What does the & at the beginning of the functi...

Regex to replace ampersands, but not when they're in a URL

So I have this regex: &(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);) That matches all &'s in a block of text However, if I have this string: & & & & & <a href="http://localhost/MyFile.aspx?mything=2&amp;this=4"&gt;My Text &</a> ---------------------------------------------------------^ ... the marked & also get's targeted - and as I'm using i...

PHP & Conditional

I was searching the net for a random password generator and I come across this code <?php function generatePassword($length=9, $strength=0) { $vowels = 'aeuy'; $consonants = 'bdghjmnpqrstvz'; if ($strength & 1) { $consonants .= 'BDGHJLMNPQRSTVWXZ'; } if ($strength & 2) { $vowels .= "AEUY"; } if ($s...

ampersand not passing through url

On my site www.gibberize.com if you type in the word "and" in the top textarea, the character "&" will appear in the second textarea. The problem is that the "tweet it" link will then append the second textarea's text to a url and proceed to the link, but because it is an ampersand it will break the text. Any solutions? ...

How to get ASP.NET HyperLink control to encode ampersands in Text attribute?

I use the following control to output a HTML link: <asp:HyperLink ID="hlEditDetails" runat="server" CssClass="arrow-forward" Text="Edit Details &amp; Photo" /> However, when it does, the markup is generated as: <a id="ctl00_hlEditDetails" class="arrow-forward" href="/EventName/EditDetails.aspx?ID=1">Edit Details & Photo</a> The une...

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

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...

What does the '&' operator do in C++?

n00b question. I am a C guy and I'm trying to understand some C++ code. I have the following function declaration: int foo(const string &myname) { cout << "called foo for: " << myname << endl; return 0; } How does the function signature differ from the equivalent C: int foo(const char *myname) Is there a difference between usin...

PHP DOMDocument->loadXML with XML containing ampersand/less/greater ???

I'm trying to parse an XML string containing characters & < and > in the TEXTDATA. Normally, those characters should be htmlencoded, but in my case they aren't so I get the following messages: Warning: DOMDocument::loadXML() [function.loadXML]: error parsing attribute name in Entity ... Warning: DOMDocument::loadXML() [function.loadXML]...

How-to XHTML 1.1 validate an ampersand without escaping it?

My issue is the following. I have a XHTML 1.1 page that has a form and input fields. One of the input fields contains a value which is an URI. This URI contains key-value pairs with ampersand (&) as argument separator, that will be passed as a GET request by another web application in the browser. Usually I would use the entity &amp; to...

Replace & to &amp; in URLs

I have TONS of XML Parsing Error: EntityRef: expecting ';' errors on my page only because of the incorrect use ampersands in links by the developer. Instead of asking him to use &amp; instead of &, how can I replace those after page load using jQuery? Edit: Ah right, validators read the source so it won't work. Is there any other way ...

Joomla complient w3c

Im trying to make my joomla powered site w3c compliant. I am stuck with ampersand encoding, I want to encode the '&' to '& amp;'(no space) under the menu, as required. However the menu link can not be directly edited (read-only), I was wondering how I can change this to be encoded? Thanks ...