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 such accents, which is common for Internationalized Domain Names (IDN). To add your domain with non-ASCII characters, you’ll need to add a Punycode version of your domain name, as special characters aren’t directly supported by DNS. Punycode is a special encoding used to convert Unicode characters to ASCII, which is a smaller, restricted character set.
For example, if you wanted to add the domain екампле.цом
to your DigitalOcean account, it would need to be added as xn--80ajbsgfv.xn--l1adx
, which is екампле.цом
after being converted to Punycode. After being added as xn--80ajbsgfv.xn--l1adx
, users will be able to enter екампле.цом
in their web browser and access your site. Attempting to directly register екампле.цом
as a domain name in DigitalOcean would result in an error.
You can convert your domain to Punycode using a tool like PunyCoder.
Linux users can also install the idn
package and convert a non-ASCII domain name to Punycode using these commands:
apt install idn
echo "екампле.цом" | idn