Bluehost: Web hosting from $3.95/month. Sign Up

Valid (X)HTML, Dreamweaver and unencoded ampersands

Posted on by Clive Walker in Dreamweaver Web Standards

One of the reasons why a webpage might not pass the W3C markup validation test is unencoded ampersands in the link URLs. This can often happen with links provided by affiliate schemes. You copy and paste the link code into your valid (X)HTML page and, lo and behold, the page no longer validates. Well, Dreamweaver can help.

» from the Adobe store.

We have been attempting to improve several websites so that they pass the W3C test and this ‘problem’ caused us to think twice. It can be quite a chore to go back through a website and edit the URLs so that “&” is changed to its encoded version†

However, if you use Dreamweaver 8 and paste the URL into the Properties panel, DW will convert the unencoded characters in the URL for you if your web page has the correct XHTML doctype.

In our limited testing, this does not work with DW8 and HTML 4 doctypes.

By doing this, Dreamweaver 8 converts any unencoded ampersands in a URL into the encoded characters. Great!

Note added: Dreamweaver’s code rewriting functions can be changed in Edit – Preferences – Code Rewriting

Using Dreamweaver’s find and replace function is another way of replacing “&” by the encoded version.

† The encoded version (aka HTML character entity) is &amp followed by a semi-colon. It’s required in this format in order to be valid markup. See this article for more details.

Leave a comment

A simple question that helps prevent automated form fillers.

© 2016 Clive Walker