Goufalite is entirely correct about this problem: it's not a technical issue at all, just a naming problem, so a lot of the advice is very opinionated based on the author's idea of what names are best.
The MQTT 3.1 specification says:
- Topic Names and Topic Filters are case sensitive
- Topic Names and Topic Filters can include the space character
- Topic Names and Topic Filters are UTF-8 encoded strings, they MUST NOT encode to more than 65535 bytes
So, purely speaking on technical grounds, the ASCII-only and 'no spaces' rules are not necessary; all compliant MQTT brokers should be able to handle them just fine.
I don't really agree with some of the points HiveMQ make anyway:
A space is the natural enemy of each programmer, they often make it much harder to read and debug topics, when things are not going the way, they should be. So similar to the first one, only because something is allowed doesn’t mean it should be used. UTF-8 knows many different white space types, it’s pretty obvious that such uncommon characters should be avoided.
It's highly unlikely you're going to be using spaces any other way than just pressing the SPACE key on your keyboard, so I don't think accidental usage of homoglyphs is really going to be a problem.
Using non-ASCII UTF-8 character makes it really hard to find typos or issues related to the character set, because often they can not be displayed correctly. Unless it is really necessary we recommend avoid using non ASCII character in a topic.
Fair point - typing non-ASCII characters can be a big problem. Personally, I would avoid Garage_Sensor_001/Temperature/°C
simply because a lot of keyboards don't have a degrees symbol built-in (British keyboards certainly don't!). This decision is really based on practicality rather than due to the protocol; if you are able to use special characters without much fuss, and you're certain that no-one else will need to type the characters in, go for it!
Also, I'd be a little sceptical about some of HiveMQ's advice; further on in the page you linked, it says "Don't subscribe to #", which has already been disputed on the site!