views:

223

answers:

1

Strangely enough, anytime I have an & in an HREF to indicate querystring parameters I receive the following error on the Blackberry Curve:

Error encountered during XML parse: expecting ';'.

Is there any way to get it to accept & in querystrings? Other mobile browsers don't like the ; to separate querystring parameters.

NOTE: I am using ASP.NET 2.0 if that makes a difference.

+5  A: 

Blackberry is (for once) correct. Your code is not valid XML (or HTML), as the Validator will confirm.

Is there any way to get it to accept & in querystrings?

Yes, the same way you get an ampersand into any attribute value or text content. HTML-encode it.

Fish & Chips
<div title="Little &amp; Large">
<a href="/script.aspx?x=y&amp;a=b">

Other mobile browsers don't like the ; to separate querystring parameters.

That's a server-side issue rather than a browser issue. Whilst the HTML4 spec recommends that servers accept ; as an alternative separator character to &, precisely to avoid the annoyance of having to write &amp; so much, sadly not all servers actually allow this.

bobince
Nissan Fan
bobince