De jure discrimination for non-Muslims and expatriates does not exist, but de facto discrimination might. While there were issues in a conservative Emirate a decade ago, the man-bun (as an example) is now fashionable for some people and includes long hair, in the same place.
Context is important: if you’re worried about traveling to a very rural, backwoods part of Pakistan, for example, you may encounter stares of consternation. If you’re traveling to Tehran or Shiraz or any large city in Iran, you’ll be fine: I’ve seen long hair on men in both places.
Emphasis on context: if you’re causing trouble, you might have de facto discrimination just like someone with a lot of tattoos in some parts of rural America could be discriminated against, even though there’s no law against it.
If you always check all laws before traveling and be a courteous visitor and don’t cause a stir from your appearance, then you are generally fine.
Credit:stackoverflow.com‘