If you receive the errors Name contains invalid characters
and Only valid hostname characters are allows...
when adding your domain name to your DigitalOcean account, your domain name likely contains non-ASCII characters, like accents. This is common for Internationalized Domain Names (IDN).
DNS does not directly support Unicode special characters. To add a domain with non-ASCII characters to DigitalOcean, you need to convert the domain into Punycode. Punycode is an encoding used to convert Unicode characters to ASCII, which is a smaller, restricted character set supported by DNS.
For example, the domain екампле.цом
is xn--80ajbsgfv.xn--l1adx
in Punycode. When you add xn--80ajbsgfv.xn--l1adx
to your DigitalOcean account, users can enter екампле.цом
in their web browser and access the site. If you try to directly register екампле.цом
as a domain name in DigitalOcean, you receive an error.
You can convert your domain to Punycode using a tool like PunyCoder. On Linux, you can install idn
(with apt install idn
) and use it on the command line (for example, echo "екампле.цом" | idn
).