Posts tagged “URLs”
It might surprise some people to learn that not all dashes are created equal; we have Em Dashes, En Dashes and Hyphens each with their own purpose. No one would blame you if you didn’t know because most of us aren’t grammar nerds.
This is probably why office applications like MS Word think they’re being helpful by automatically replacing certain characters, say 2 hyphens, with an appropriate dash. But it just makes the different dashes all the more invisible to the regular user.

What does this have to do with web development? Using any dash but hyphens in a URL can have unexpected consequences. Case in point, a client wanted to link to a file from their Content Management System which is normally straight-forward but the system kept rejecting it.
Let’s say the file name was mental-models-for–first-time-users.pdf. It may be hard to see but the third dash is not a hyphen but an En Dash. Before accepting the file, the system checks that the file name can be part of a valid URL (i.e. http://mycooldomain.com/mental-models-for-first-time-users.pdf) because it will eventually need to link to the file. This check failed because the system erred on the side of security.
Now to be fair, dashes appear to be valid in URLs (I say “appear” because I don’t understand enough of RFC 3986 to know for sure). But the general wisdom is to avoid using them in file names and URIs.
So what happened in my client’s case? My best guess is that the file name was at one point in time typed into MS Word which changed one of the hyphens into an En Dash. They copied that text and used it to name the file.

Social Media Links