📜 ⬆️ ⬇️

Domain support. RF in Biggo and Python

A couple of days ago, following the general trend, we began to support domains. RF, besides, it turned out to be easy.
As you know, transcoding in punycode takes place on the client side, so all you had to do was transcode the Cyrillic name in the forms for creating and renaming sites, as well as in the functions of working with the registrar and DNS hosting. I liked very much that the possibility of recoding is built into the language itself (Python):

domain_rf = u'.'
domain = domain_rf.encode('idna')


That is, idna codec does everything for us. Compare with the PHP solution =)
We store domain names in the form of xn - 80aswg.xn - p1ai and it works just like for other domains.
')
You can translate back as follows:
domain = u'xn--80aswg.xn--p1ai'
domain_rf = domain.decode('idna')

Source: https://habr.com/ru/post/108642/


All Articles