Why would you expect non compliant names to work anywhere. Even if a tool parses it okay there is no guarantees that the underlying resolution standard libraries or system calls will allow it either.
The correct solution is to used compliant host names.