My favorite domain registrar is NameSilo and if you use the affiliate link here it helps me earn some money from my writing: https://www.namesilo.com/pricing.php?rid=ee81e92mn, thanks! If you are new to NameSilo you can use my coupon, MARKUSTENGHAMN to save $1.00.
This post has been migrated and imported into different systems over the years, I have not had a chance to format this post manually so it may be hard to read but I have left it here as a reference.
So I am sitting here late at night and I registered a few swedish .xyz domains that contain characters åäö. For example you may have the domain for horse in swedish, häst.xyz, this domain is actually written as xn–hst-qla.xyz. Now I wanted to create a temporary catch-all page for these swedish domains until I can build a site for them. What I did was to get the domain name as a variable which I echo in the title and body of the page using the following server variable:
this works ok but for domains with äåö it will output the weird looking punycode which is not really seo or user friendly. To solve this we can use the
idn_to_utf8() function in PHP which takes the punicode and converts it to UTF-8 characters which will show the åäö characters. For my site I also wanted to make the first character upper case so I used the ucfirst() function. My page ended up looking like this.
<html><br></br> <head><br></br> <title><?php echo ucfirst(idn_to_utf8($_SERVER['HTTP_HOST'])); ?> - Coming soon!</title><br></br> </head><br></br> <body><br></br> <center><br></br> <br/><br></br> <br/><br></br> <br/><br></br> <h1><?php echo ucfirst(idn_to_utf8($_SERVER['HTTP_HOST'])); ?></h1><br></br> </center><br></br> </body><br></br> </html>
I hope some of you find this useful.