Unfortunately, Lemmy cannot handle community names over 20 characters, so this won’t be possible.
Can you somehow us a very short hash function in those cases?
That could work, but it would be terrible for discoverability. In the mean time, I put up a feature request at Lemmy. I’m not a fan of pushing my problems upstream, but in this case it would actually be the easiest solution - as far as I can see (and I have 0 experience with Rust) they only need to adjust the validation regex, because the database already allows for it. That is - as long as the ActivityPub protocol allows for it.
If they deny it, I could try something with name mapping, but you’d either end up with something that is unreadable, or something with a high collision chance. Neither option is very appealing. For now I’m just going to wait and see.