Hacker News new | ask | show | jobs
by smurda 16 days ago
I love last.fm but never understood the URL structure naming convention. Why use a "+" instead of a "-" for every band page (e.g. https://www.last.fm/music/The+Beatles).

I thought Kebab-case is usually the norm, and I don't think I've seen the "+" in any other URL paths that aren't query strings. Any ideas why they formatted it like this?

3 comments

I believe "+" is the URL encoding for space and they're just putting the band names into the URL before encoding (thus "The Beatles" -> "The+Beatles")
I've checked RFC 1738 and it's not the case. The only standard for "+" is:

> (RFC 1866) specifies that space characters should be encoded as `+` in application/x-www-form-urlencoded content-type key-value pairs (see paragraph 8.2.1, subparagraph 1).

From https://stackoverflow.com/a/40292770

RFC1738 is obsolete. RFC1866, referenced in that SO answer, is also obsolete.

But none of that matters, particularly, because lastfm are consuming the URLs, they know full well what "+" means in a URL submitted to their servers, and also they've been around for decades (well before the whole "use %20 instead") - why on earth would they change up their URL scheme when it's working fine?

I suspect it was an intentional choice so that artist names like Jay-Z remain properly separated in the URL, especially in cases of multiple-artist billings (ex. https://www.last.fm/music/Nas+&+Jay-Z)
The "-" character appears pretty frequently in song/album titles, maybe even artist names. There could be some sense in not using it as a substitute for space in this context.