0

I've found this question and I understand that the HTML5 specifications say that. Period.

But I'm creating a MVC3 app that uses Google Charts API (images) and I need to use images with links to a google adress and they have a querystring. Just like this:

http://chart.apis.google.com/chart?chs=440x220&cht=t&chco=EFEFEF&chld=BRJPUS&chd=t:20,30,50&chtm=world

I've tested getting a working chart and change a single ampersand to & and the chart returned a error from Google.

How to fix this?

Community
  • 1
  • 1
programad
  • 1,291
  • 3
  • 19
  • 38
  • 2
    Can you post a [JS Fiddle](http://jsfiddle.net/) demo, showing what does, and doesn't, work? I'm not sure I understand your question as it stands (but it *is* late in the UK, or early, so that might be why...). – David Thomas Sep 17 '11 at 01:51
  • Not sure I understand your question either. Putting regular old ampersands (&) in the querystring of your anchor hrefs should never generate an error. No error for any other element attribute either. What's the real issue? Does `` not work? – Jonathan Wilson Sep 17 '11 at 02:32
  • If the *markup* in the browser is `link` the *link* read by the browser is "http://foo/a&b". Thus `&` should *always* (with a few exclusions such as ` –  Sep 17 '11 at 04:09

1 Answers1

1

There's nothing to fix in your generated url. It works just fine and generates an image.

Are you actually referring to & amp; (without the space of course) If thats the case and it causes an error, UrlDecode the querystring as its encoded. UrlDecode: http://msdn.microsoft.com/en-us/library/6196h3wt.aspx

Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
  • Found what was wrong. I've tested the url directly on the browser and got an error. When I changed the & to & amp; on the code, the browser rendered it correctly. – programad Sep 18 '11 at 05:08